# HG changeset patch # User pliden # Date 1554192265 -7200 # Node ID a5ce9300462fdd05b613573984d0052ae3f538fa # Parent 22eb1f7416f10de5596e741eac7373a9d7422b61 8221648: Remove CollectedHeap::is_in_closed_subset() Reviewed-by: kbarrett, tschatzl diff -r 22eb1f7416f1 -r a5ce9300462f src/hotspot/share/gc/g1/g1CollectedHeap.cpp --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Wed Mar 27 10:25:12 2019 +0100 +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Tue Apr 02 10:04:25 2019 +0200 @@ -2731,7 +2731,7 @@ // The remembered set might contain references to already freed // regions. Filter out such entries to avoid failing card table // verification. - if (g1h->is_in_closed_subset(ct->addr_for(card_ptr))) { + if (g1h->is_in(ct->addr_for(card_ptr))) { if (*card_ptr != G1CardTable::dirty_card_val()) { *card_ptr = G1CardTable::dirty_card_val(); _dcq.enqueue(card_ptr); @@ -4608,11 +4608,6 @@ used(), recalculate_used()); } -bool G1CollectedHeap::is_in_closed_subset(const void* p) const { - HeapRegion* hr = heap_region_containing(p); - return hr->is_in(p); -} - // Methods for the mutator alloc region HeapRegion* G1CollectedHeap::new_mutator_alloc_region(size_t word_size, diff -r 22eb1f7416f1 -r a5ce9300462f src/hotspot/share/gc/g1/g1CollectedHeap.hpp --- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp Wed Mar 27 10:25:12 2019 +0100 +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp Tue Apr 02 10:04:25 2019 +0200 @@ -1119,8 +1119,6 @@ return _hrm->reserved(); } - virtual bool is_in_closed_subset(const void* p) const; - G1HotCardCache* g1_hot_card_cache() const { return _hot_card_cache; } G1CardTable* card_table() const { diff -r 22eb1f7416f1 -r a5ce9300462f src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp --- a/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp Wed Mar 27 10:25:12 2019 +0100 +++ b/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp Tue Apr 02 10:04:25 2019 +0200 @@ -61,7 +61,7 @@ _cc++; oop obj = CompressedOops::decode_not_null(heap_oop); bool failed = false; - if (!_g1h->is_in_closed_subset(obj) || _g1h->is_obj_dead_cond(obj, _verify_option)) { + if (!_g1h->is_in(obj) || _g1h->is_obj_dead_cond(obj, _verify_option)) { MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag); LogStreamHandle(Error, gc, verify) yy; @@ -69,7 +69,7 @@ yy.cr(); yy.print_cr("----------"); } - if (!_g1h->is_in_closed_subset(obj)) { + if (!_g1h->is_in(obj)) { HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); yy.print_cr("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region " HR_FORMAT, p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from)); diff -r 22eb1f7416f1 -r a5ce9300462f src/hotspot/share/gc/g1/heapRegion.cpp --- a/src/hotspot/share/gc/g1/heapRegion.cpp Wed Mar 27 10:25:12 2019 +0100 +++ b/src/hotspot/share/gc/g1/heapRegion.cpp Tue Apr 02 10:04:25 2019 +0200 @@ -514,7 +514,7 @@ if (!CompressedOops::is_null(heap_oop)) { oop obj = CompressedOops::decode_not_null(heap_oop); bool failed = false; - if (!_g1h->is_in_closed_subset(obj) || _g1h->is_obj_dead_cond(obj, _vo)) { + if (!_g1h->is_in(obj) || _g1h->is_obj_dead_cond(obj, _vo)) { MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag); @@ -522,7 +522,7 @@ log.error("----------"); } ResourceMark rm; - if (!_g1h->is_in_closed_subset(obj)) { + if (!_g1h->is_in(obj)) { HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); log.error("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region " HR_FORMAT, p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from)); diff -r 22eb1f7416f1 -r a5ce9300462f src/hotspot/share/gc/serial/serialHeap.hpp --- a/src/hotspot/share/gc/serial/serialHeap.hpp Wed Mar 27 10:25:12 2019 +0100 +++ b/src/hotspot/share/gc/serial/serialHeap.hpp Tue Apr 02 10:04:25 2019 +0200 @@ -59,11 +59,6 @@ virtual GrowableArray memory_managers(); virtual GrowableArray memory_pools(); - // override - virtual bool is_in_closed_subset(const void* p) const { - return is_in(p); - } - DefNewGeneration* young_gen() const { assert(_young_gen->kind() == Generation::DefNew, "Wrong generation type"); return static_cast(_young_gen); diff -r 22eb1f7416f1 -r a5ce9300462f src/hotspot/share/gc/shared/collectedHeap.hpp --- a/src/hotspot/share/gc/shared/collectedHeap.hpp Wed Mar 27 10:25:12 2019 +0100 +++ b/src/hotspot/share/gc/shared/collectedHeap.hpp Tue Apr 02 10:04:25 2019 +0200 @@ -239,38 +239,6 @@ DEBUG_ONLY(bool is_in_or_null(const void* p) const { return p == NULL || is_in(p); }) - // Let's define some terms: a "closed" subset of a heap is one that - // - // 1) contains all currently-allocated objects, and - // - // 2) is closed under reference: no object in the closed subset - // references one outside the closed subset. - // - // Membership in a heap's closed subset is useful for assertions. - // Clearly, the entire heap is a closed subset, so the default - // implementation is to use "is_in_reserved". But this may not be too - // liberal to perform useful checking. Also, the "is_in" predicate - // defines a closed subset, but may be too expensive, since "is_in" - // verifies that its argument points to an object head. The - // "closed_subset" method allows a heap to define an intermediate - // predicate, allowing more precise checking than "is_in_reserved" at - // lower cost than "is_in." - - // One important case is a heap composed of disjoint contiguous spaces, - // such as the Garbage-First collector. Such heaps have a convenient - // closed subset consisting of the allocated portions of those - // contiguous spaces. - - // Return "TRUE" iff the given pointer points into the heap's defined - // closed subset (which defaults to the entire heap). - virtual bool is_in_closed_subset(const void* p) const { - return is_in_reserved(p); - } - - bool is_in_closed_subset_or_null(const void* p) const { - return p == NULL || is_in_closed_subset(p); - } - void set_gc_cause(GCCause::Cause v) { if (UsePerfData) { _gc_lastcause = _gc_cause; diff -r 22eb1f7416f1 -r a5ce9300462f src/hotspot/share/gc/shared/genCollectedHeap.hpp --- a/src/hotspot/share/gc/shared/genCollectedHeap.hpp Wed Mar 27 10:25:12 2019 +0100 +++ b/src/hotspot/share/gc/shared/genCollectedHeap.hpp Tue Apr 02 10:04:25 2019 +0200 @@ -234,10 +234,9 @@ void collect(GCCause::Cause cause, GenerationType max_generation); // Returns "TRUE" iff "p" points into the committed areas of the heap. - // The methods is_in(), is_in_closed_subset() and is_in_youngest() may - // be expensive to compute in general, so, to prevent - // their inadvertent use in product jvm's, we restrict their use to - // assertion checking or verification only. + // The methods is_in() and is_in_youngest() may be expensive to compute + // in general, so, to prevent their inadvertent use in product jvm's, we + // restrict their use to assertion checking or verification only. bool is_in(const void* p) const; // Returns true if the reference is to an object in the reserved space diff -r 22eb1f7416f1 -r a5ce9300462f src/hotspot/share/gc/z/zCollectedHeap.cpp --- a/src/hotspot/share/gc/z/zCollectedHeap.cpp Wed Mar 27 10:25:12 2019 +0100 +++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp Tue Apr 02 10:04:25 2019 +0200 @@ -110,10 +110,6 @@ return is_in_reserved(p) && _heap.is_in((uintptr_t)p); } -bool ZCollectedHeap::is_in_closed_subset(const void* p) const { - return is_in(p); -} - HeapWord* ZCollectedHeap::allocate_new_tlab(size_t min_size, size_t requested_size, size_t* actual_size) { const size_t size_in_bytes = ZUtils::words_to_bytes(align_object_size(requested_size)); const uintptr_t addr = _heap.alloc_tlab(size_in_bytes); diff -r 22eb1f7416f1 -r a5ce9300462f src/hotspot/share/gc/z/zCollectedHeap.hpp --- a/src/hotspot/share/gc/z/zCollectedHeap.hpp Wed Mar 27 10:25:12 2019 +0100 +++ b/src/hotspot/share/gc/z/zCollectedHeap.hpp Tue Apr 02 10:04:25 2019 +0200 @@ -72,7 +72,6 @@ virtual bool is_maximal_no_gc() const; virtual bool is_in(const void* p) const; - virtual bool is_in_closed_subset(const void* p) const; virtual HeapWord* mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded); virtual MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data, diff -r 22eb1f7416f1 -r a5ce9300462f src/hotspot/share/jvmci/jvmciRuntime.cpp --- a/src/hotspot/share/jvmci/jvmciRuntime.cpp Wed Mar 27 10:25:12 2019 +0100 +++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp Tue Apr 02 10:04:25 2019 +0200 @@ -565,12 +565,12 @@ JRT_LEAF(jboolean, JVMCIRuntime::validate_object(JavaThread* thread, oopDesc* parent, oopDesc* child)) bool ret = true; - if(!Universe::heap()->is_in_closed_subset(parent)) { + if(!Universe::heap()->is_in(parent)) { tty->print_cr("Parent Object " INTPTR_FORMAT " not in heap", p2i(parent)); parent->print(); ret=false; } - if(!Universe::heap()->is_in_closed_subset(child)) { + if(!Universe::heap()->is_in(child)) { tty->print_cr("Child Object " INTPTR_FORMAT " not in heap", p2i(child)); child->print(); ret=false; diff -r 22eb1f7416f1 -r a5ce9300462f src/hotspot/share/memory/iterator.inline.hpp --- a/src/hotspot/share/memory/iterator.inline.hpp Wed Mar 27 10:25:12 2019 +0100 +++ b/src/hotspot/share/memory/iterator.inline.hpp Tue Apr 02 10:04:25 2019 +0200 @@ -56,7 +56,7 @@ T heap_oop = RawAccess<>::oop_load(p); if (!CompressedOops::is_null(heap_oop)) { oop o = CompressedOops::decode_not_null(heap_oop); - assert(Universe::heap()->is_in_closed_subset(o), + assert(Universe::heap()->is_in(o), "should be in closed *p " PTR_FORMAT " " PTR_FORMAT, p2i(p), p2i(o)); } }