# HG changeset patch # User pliden # Date 1568901947 -7200 # Node ID 722a19a459941d97dd14ec7552fbbd69405eeb39 # Parent 408c445d04e83bb3e85997d666849b1e47f4bbdc 8231113: Remove CollectedHeap::check_oop_location() Reviewed-by: stefank, eosterlund, tschatzl diff -r 408c445d04e8 -r 722a19a45994 src/hotspot/share/gc/cms/cmsHeap.hpp --- a/src/hotspot/share/gc/cms/cmsHeap.hpp Thu Sep 19 10:52:22 2019 +0200 +++ b/src/hotspot/share/gc/cms/cmsHeap.hpp Thu Sep 19 16:05:47 2019 +0200 @@ -135,10 +135,6 @@ bool should_do_concurrent_full_gc(GCCause::Cause cause); void collect_mostly_concurrent(GCCause::Cause cause); - - // CMS forwards some non-heap value into the mark oop to reserve oops during - // promotion, so we can't assert about obj alignment or that the forwardee is in heap - virtual void check_oop_location(void* addr) const {} }; #endif // SHARE_GC_CMS_CMSHEAP_HPP diff -r 408c445d04e8 -r 722a19a45994 src/hotspot/share/gc/g1/g1OopClosures.inline.hpp --- a/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp Thu Sep 19 10:52:22 2019 +0200 +++ b/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp Thu Sep 19 16:05:47 2019 +0200 @@ -38,6 +38,7 @@ #include "oops/oopsHierarchy.hpp" #include "oops/oop.inline.hpp" #include "runtime/prefetch.inline.hpp" +#include "utilities/align.hpp" template inline void G1ScanClosureBase::prefetch_and_push(T* p, const oop obj) { @@ -115,7 +116,8 @@ G1CollectedHeap* g1h = G1CollectedHeap::heap(); // can't do because of races // assert(oopDesc::is_oop_or_null(obj), "expected an oop"); - g1h->check_oop_location(obj); + assert(is_object_aligned(obj), "oop must be aligned"); + assert(g1h->is_in_reserved(obj), "oop must be in reserved"); HeapRegion* from = g1h->heap_region_containing(p); diff -r 408c445d04e8 -r 722a19a45994 src/hotspot/share/gc/serial/markSweep.inline.hpp --- a/src/hotspot/share/gc/serial/markSweep.inline.hpp Thu Sep 19 10:52:22 2019 +0200 +++ b/src/hotspot/share/gc/serial/markSweep.inline.hpp Thu Sep 19 16:05:47 2019 +0200 @@ -32,6 +32,7 @@ #include "oops/access.inline.hpp" #include "oops/compressedOops.inline.hpp" #include "oops/oop.inline.hpp" +#include "utilities/align.hpp" #include "utilities/stack.inline.hpp" inline void MarkSweep::mark_object(oop obj) { @@ -87,7 +88,7 @@ "should be forwarded"); if (new_obj != NULL) { - DEBUG_ONLY(Universe::heap()->check_oop_location((HeapWord*)new_obj);) + assert(is_object_aligned(new_obj), "oop must be aligned"); RawAccess::oop_store(p, new_obj); } } diff -r 408c445d04e8 -r 722a19a45994 src/hotspot/share/gc/shared/collectedHeap.cpp --- a/src/hotspot/share/gc/shared/collectedHeap.cpp Thu Sep 19 10:52:22 2019 +0200 +++ b/src/hotspot/share/gc/shared/collectedHeap.cpp Thu Sep 19 16:05:47 2019 +0200 @@ -343,11 +343,6 @@ } #endif // PRODUCT -void CollectedHeap::check_oop_location(void* addr) const { - assert(is_object_aligned(addr), "address is not aligned"); - assert(_reserved.contains(addr), "address is not in reserved heap"); -} - size_t CollectedHeap::max_tlab_size() const { // TLABs can't be bigger than we can fill with a int[Integer.MAX_VALUE]. // This restriction could be removed by enabling filling with multiple arrays. @@ -376,8 +371,6 @@ { assert(words >= min_fill_size(), "too small to fill"); assert(is_object_aligned(words), "unaligned size"); - DEBUG_ONLY(Universe::heap()->check_oop_location(start);) - DEBUG_ONLY(Universe::heap()->check_oop_location(start + words - MinObjAlignment);) } void CollectedHeap::zap_filler_array(HeapWord* start, size_t words, bool zap) diff -r 408c445d04e8 -r 722a19a45994 src/hotspot/share/gc/shared/collectedHeap.hpp --- a/src/hotspot/share/gc/shared/collectedHeap.hpp Thu Sep 19 10:52:22 2019 +0200 +++ b/src/hotspot/share/gc/shared/collectedHeap.hpp Thu Sep 19 16:05:47 2019 +0200 @@ -233,11 +233,6 @@ DEBUG_ONLY(bool is_in_or_null(const void* p) const { return p == NULL || is_in(p); }) - // This function verifies that "addr" is a valid oop location, w.r.t. heap - // datastructures such as bitmaps and virtual memory address. It does *not* - // check if the location is within committed heap memory. - virtual void check_oop_location(void* addr) const; - virtual uint32_t hash_oop(oop obj) const; void set_gc_cause(GCCause::Cause v) { diff -r 408c445d04e8 -r 722a19a45994 src/hotspot/share/gc/z/zCollectedHeap.cpp --- a/src/hotspot/share/gc/z/zCollectedHeap.cpp Thu Sep 19 10:52:22 2019 +0200 +++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp Thu Sep 19 16:05:47 2019 +0200 @@ -368,11 +368,3 @@ bool ZCollectedHeap::is_oop(oop object) const { return CollectedHeap::is_oop(object) && _heap.is_oop(object); } - -void ZCollectedHeap::check_oop_location(void* addr) const { - assert(is_object_aligned(addr), "address is not aligned"); - - const uintptr_t addr_int = reinterpret_cast(addr); - assert(addr_int >= ZAddressSpaceStart, "address is outside of the heap"); - assert(addr_int < ZAddressSpaceEnd, "address is outside of the heap"); -} diff -r 408c445d04e8 -r 722a19a45994 src/hotspot/share/gc/z/zCollectedHeap.hpp --- a/src/hotspot/share/gc/z/zCollectedHeap.hpp Thu Sep 19 10:52:22 2019 +0200 +++ b/src/hotspot/share/gc/z/zCollectedHeap.hpp Thu Sep 19 16:05:47 2019 +0200 @@ -126,7 +126,6 @@ virtual void prepare_for_verify(); virtual void verify(VerifyOption option /* ignored */); virtual bool is_oop(oop object) const; - virtual void check_oop_location(void* addr) const; }; #endif // SHARE_GC_Z_ZCOLLECTEDHEAP_HPP diff -r 408c445d04e8 -r 722a19a45994 src/hotspot/share/oops/compressedOops.inline.hpp --- a/src/hotspot/share/oops/compressedOops.inline.hpp Thu Sep 19 10:52:22 2019 +0200 +++ b/src/hotspot/share/oops/compressedOops.inline.hpp Thu Sep 19 16:05:47 2019 +0200 @@ -58,7 +58,8 @@ inline narrowOop CompressedOops::encode_not_null(oop v) { assert(!is_null(v), "oop value can never be zero"); - DEBUG_ONLY(Universe::heap()->check_oop_location(v);) + assert(is_object_aligned(v), "address not aligned: " PTR_FORMAT, p2i((void*)v)); + assert(is_in(v), "address not in heap range: " PTR_FORMAT, p2i((void*)v)); uint64_t pd = (uint64_t)(pointer_delta((void*)v, (void*)base(), 1)); assert(OopEncodingHeapMax > pd, "change encoding max if new encoding"); uint64_t result = pd >> shift(); diff -r 408c445d04e8 -r 722a19a45994 src/hotspot/share/oops/oop.cpp --- a/src/hotspot/share/oops/oop.cpp Thu Sep 19 10:52:22 2019 +0200 +++ b/src/hotspot/share/oops/oop.cpp Thu Sep 19 16:05:47 2019 +0200 @@ -209,7 +209,6 @@ #ifdef ASSERT void oopDesc::verify_forwardee(oop forwardee) { - Universe::heap()->check_oop_location(forwardee); #if INCLUDE_CDS_JAVA_HEAP assert(!HeapShared::is_archived_object(forwardee) && !HeapShared::is_archived_object(this), "forwarding archive object");