OpenJDK / zgc / zgc
changeset 49858:66eb1ad3de72
ZGC: UPSTREAM: Introduce CollectedHeap::is_oop()
author | duke |
---|---|
date | Mon, 16 Apr 2018 15:44:08 +0200 |
parents | 85b2da3d0dd0 |
children | 59582911e5e9 |
files | src/hotspot/share/gc/shared/collectedHeap.cpp src/hotspot/share/gc/shared/collectedHeap.hpp src/hotspot/share/oops/oop.cpp |
diffstat | 3 files changed, 21 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/hotspot/share/gc/shared/collectedHeap.cpp Mon Apr 16 15:44:08 2018 +0200 +++ b/src/hotspot/share/gc/shared/collectedHeap.cpp Mon Apr 16 15:44:08 2018 +0200 @@ -172,6 +172,22 @@ return false; } +bool CollectedHeap::is_oop(oop object) const { + if (!check_obj_alignment(object)) { + return false; + } + + if (!is_in_reserved(object)) { + return false; + } + + if (is_in_reserved(object->klass_or_null())) { + return false; + } + + return true; +} + // Memory state functions.
--- a/src/hotspot/share/gc/shared/collectedHeap.hpp Mon Apr 16 15:44:08 2018 +0200 +++ b/src/hotspot/share/gc/shared/collectedHeap.hpp Mon Apr 16 15:44:08 2018 +0200 @@ -591,6 +591,8 @@ virtual oop pin_object(JavaThread* thread, oop obj); virtual void unpin_object(JavaThread* thread, oop obj); + virtual bool is_oop(oop object) const; + // Non product verification and debugging. #ifndef PRODUCT // Support for PromotionFailureALot. Return true if it's time to cause a
--- a/src/hotspot/share/oops/oop.cpp Mon Apr 16 15:44:08 2018 +0200 +++ b/src/hotspot/share/oops/oop.cpp Mon Apr 16 15:44:08 2018 +0200 @@ -122,10 +122,9 @@ // used only for asserts and guarantees bool oopDesc::is_oop(oop obj, bool ignore_mark_word) { - if (!check_obj_alignment(obj)) return false; - if (!Universe::heap()->is_in_reserved(obj)) return false; - // obj is aligned and accessible in heap - if (Universe::heap()->is_in_reserved(obj->klass_or_null())) return false; + if (!Universe::heap()->is_oop(obj)) { + return false; + } // Header verification: the mark is typically non-NULL. If we're // at a safepoint, it must not be null.