# HG changeset patch # Parent d2738e1be37ac3317a2bcf1d08502415f8a0be84 diff -r d2738e1be37a src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp Mon Apr 06 20:35:50 2020 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp Tue Apr 07 19:46:56 2020 +0200 @@ -142,7 +142,6 @@ if (obj == fwd) { assert(_heap->is_evacuation_in_progress(), "evac should be in progress"); - ShenandoahEvacOOMScope scope; fwd = _heap->evacuate_object(obj, Thread::current()); } @@ -163,7 +162,6 @@ _heap->in_collection_set(obj) && obj == fwd) { Thread *t = Thread::current(); - ShenandoahEvacOOMScope oom_evac_scope; return _heap->evacuate_object(obj, t); } else { return fwd; diff -r d2738e1be37a src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp Mon Apr 06 20:35:50 2020 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp Tue Apr 07 19:46:56 2020 +0200 @@ -316,7 +316,6 @@ void ShenandoahBarrierSet::arraycopy_evacuation(T* src, size_t count) { assert(_heap->is_evacuation_in_progress(), "only during evacuation"); if (need_bulk_update(reinterpret_cast(src))) { - ShenandoahEvacOOMScope oom_evac; arraycopy_work(src, count); } } diff -r d2738e1be37a src/hotspot/share/gc/shenandoah/shenandoahBarrierSetClone.inline.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSetClone.inline.hpp Mon Apr 06 20:35:50 2020 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSetClone.inline.hpp Tue Apr 07 19:46:56 2020 +0200 @@ -27,7 +27,6 @@ #include "gc/shenandoah/shenandoahBarrierSet.inline.hpp" #include "gc/shenandoah/shenandoahCollectionSet.inline.hpp" -#include "gc/shenandoah/shenandoahEvacOOMHandler.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "memory/iterator.hpp" #include "oops/access.hpp" @@ -84,7 +83,6 @@ void ShenandoahBarrierSet::clone_evacuation(oop obj) { assert(_heap->is_evacuation_in_progress(), "only during evacuation"); if (need_bulk_update(cast_from_oop(obj))) { - ShenandoahEvacOOMScope oom_evac_scope; ShenandoahUpdateRefsForOopClosure cl; obj->oop_iterate(&cl); } diff -r d2738e1be37a src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.cpp Mon Apr 06 20:35:50 2020 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.cpp Tue Apr 07 19:46:56 2020 +0200 @@ -27,7 +27,6 @@ #include "code/icBuffer.hpp" #include "code/nmethod.hpp" #include "gc/shenandoah/shenandoahCodeRoots.hpp" -#include "gc/shenandoah/shenandoahEvacOOMHandler.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahNMethod.inline.hpp" #include "gc/shenandoah/shenandoahUtils.hpp" diff -r d2738e1be37a src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp Mon Apr 06 20:35:50 2020 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp Tue Apr 07 19:46:56 2020 +0200 @@ -163,7 +163,7 @@ void work(uint worker_id) { ShenandoahHeap* heap = ShenandoahHeap::heap(); ShenandoahConcurrentWorkerSession worker_session(worker_id); - ShenandoahSuspendibleThreadSetJoiner stsj(ShenandoahSuspendibleWorkers); + SuspendibleThreadSetJoiner stsj(ShenandoahSuspendibleWorkers); ShenandoahObjToScanQueue* q = _cm->get_queue(worker_id); ReferenceProcessor* rp; if (heap->process_references()) { @@ -928,7 +928,7 @@ if (work == 0) { // No work encountered in current stride, try to terminate. // Need to leave the STS here otherwise it might block safepoints. - ShenandoahSuspendibleThreadSetLeaver stsl(CANCELLABLE && ShenandoahSuspendibleWorkers); + SuspendibleThreadSetLeaver stsl(CANCELLABLE && ShenandoahSuspendibleWorkers); ShenandoahTerminatorTerminator tt(heap); if (terminator->offer_termination(&tt)) return; } diff -r d2738e1be37a src/hotspot/share/gc/shenandoah/shenandoahEvacOOMHandler.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahEvacOOMHandler.cpp Mon Apr 06 20:35:50 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#include "precompiled.hpp" - -#include "gc/shenandoah/shenandoahHeap.hpp" -#include "gc/shenandoah/shenandoahUtils.hpp" -#include "gc/shenandoah/shenandoahEvacOOMHandler.hpp" -#include "gc/shenandoah/shenandoahThreadLocalData.hpp" -#include "runtime/atomic.hpp" -#include "runtime/os.hpp" -#include "runtime/thread.hpp" - -const jint ShenandoahEvacOOMHandler::OOM_MARKER_MASK = 0x80000000; - -ShenandoahEvacOOMHandler::ShenandoahEvacOOMHandler() : - _threads_in_evac(0) { -} - -void ShenandoahEvacOOMHandler::wait_for_no_evac_threads() { - while ((Atomic::load_acquire(&_threads_in_evac) & ~OOM_MARKER_MASK) != 0) { - os::naked_short_sleep(1); - } - // At this point we are sure that no threads can evacuate anything. Raise - // the thread-local oom_during_evac flag to indicate that any attempt - // to evacuate should simply return the forwarding pointer instead (which is safe now). - ShenandoahThreadLocalData::set_oom_during_evac(Thread::current(), true); -} - -void ShenandoahEvacOOMHandler::enter_evacuation() { - jint threads_in_evac = Atomic::load_acquire(&_threads_in_evac); - - assert(!ShenandoahThreadLocalData::is_evac_allowed(Thread::current()), "sanity"); - assert(!ShenandoahThreadLocalData::is_oom_during_evac(Thread::current()), "TL oom-during-evac must not be set"); - - if ((threads_in_evac & OOM_MARKER_MASK) != 0) { - wait_for_no_evac_threads(); - return; - } - - while (true) { - jint other = Atomic::cmpxchg(&_threads_in_evac, threads_in_evac, threads_in_evac + 1); - if (other == threads_in_evac) { - // Success: caller may safely enter evacuation - DEBUG_ONLY(ShenandoahThreadLocalData::set_evac_allowed(Thread::current(), true)); - return; - } else { - // Failure: - // - if offender has OOM_MARKER_MASK, then loop until no more threads in evac - // - otherwise re-try CAS - if ((other & OOM_MARKER_MASK) != 0) { - wait_for_no_evac_threads(); - return; - } - threads_in_evac = other; - } - } -} - -void ShenandoahEvacOOMHandler::leave_evacuation() { - if (!ShenandoahThreadLocalData::is_oom_during_evac(Thread::current())) { - assert((Atomic::load_acquire(&_threads_in_evac) & ~OOM_MARKER_MASK) > 0, "sanity"); - // NOTE: It's ok to simply decrement, even with mask set, because unmasked value is positive. - Atomic::dec(&_threads_in_evac); - } else { - // If we get here, the current thread has already gone through the - // OOM-during-evac protocol and has thus either never entered or successfully left - // the evacuation region. Simply flip its TL oom-during-evac flag back off. - ShenandoahThreadLocalData::set_oom_during_evac(Thread::current(), false); - } - DEBUG_ONLY(ShenandoahThreadLocalData::set_evac_allowed(Thread::current(), false)); - assert(!ShenandoahThreadLocalData::is_oom_during_evac(Thread::current()), "TL oom-during-evac must be turned off"); -} - -void ShenandoahEvacOOMHandler::handle_out_of_memory_during_evacuation() { - assert(ShenandoahThreadLocalData::is_evac_allowed(Thread::current()), "sanity"); - assert(!ShenandoahThreadLocalData::is_oom_during_evac(Thread::current()), "TL oom-during-evac must not be set"); - - jint threads_in_evac = Atomic::load_acquire(&_threads_in_evac); - while (true) { - jint other = Atomic::cmpxchg(&_threads_in_evac, threads_in_evac, (threads_in_evac - 1) | OOM_MARKER_MASK); - if (other == threads_in_evac) { - // Success: wait for other threads to get out of the protocol and return. - wait_for_no_evac_threads(); - return; - } else { - // Failure: try again with updated new value. - threads_in_evac = other; - } - } -} - -void ShenandoahEvacOOMHandler::clear() { - assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "must be at a safepoint"); - assert((Atomic::load_acquire(&_threads_in_evac) & ~OOM_MARKER_MASK) == 0, "sanity"); - Atomic::release_store_fence(&_threads_in_evac, (jint)0); -} - -ShenandoahEvacOOMScope::ShenandoahEvacOOMScope() { - ShenandoahHeap::heap()->enter_evacuation(); -} - -ShenandoahEvacOOMScope::~ShenandoahEvacOOMScope() { - ShenandoahHeap::heap()->leave_evacuation(); -} diff -r d2738e1be37a src/hotspot/share/gc/shenandoah/shenandoahEvacOOMHandler.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahEvacOOMHandler.hpp Mon Apr 06 20:35:50 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHEVACOOMHANDLER_HPP -#define SHARE_GC_SHENANDOAH_SHENANDOAHEVACOOMHANDLER_HPP - -#include "gc/shenandoah/shenandoahPadding.hpp" -#include "memory/allocation.hpp" -#include "utilities/globalDefinitions.hpp" - -/** - * Provides safe handling of out-of-memory situations during evacuation. - * - * When a Java thread encounters out-of-memory while evacuating an object in a - * load-reference-barrier (i.e. it cannot copy the object to to-space), it does not - * necessarily follow we can return immediately from the LRB (and store to from-space). - * - * In very basic case, on such failure we may wait until the the evacuation is over, - * and then resolve the forwarded copy, and to the store there. This is possible - * because other threads might still have space in their GCLABs, and successfully - * evacuate the object. - * - * But, there is a race due to non-atomic evac_in_progress transition. Consider - * thread A is stuck waiting for the evacuation to be over -- it cannot leave with - * from-space copy yet. Control thread drops evacuation_in_progress preparing for - * next STW phase that has to recover from OOME. Thread B misses that update, and - * successfully evacuates the object, does the write to to-copy. But, before - * Thread B is able to install the fwdptr, thread A discovers evac_in_progress is - * down, exits from here, reads the fwdptr, discovers old from-copy, and stores there. - * Thread B then wakes up and installs to-copy. This breaks to-space invariant, and - * silently corrupts the heap: we accepted two writes to separate copies of the object. - * - * The way it is solved here is to maintain a counter of threads inside the - * 'evacuation path'. The 'evacuation path' is the part of evacuation that does the actual - * allocation, copying and CASing of the copy object, and is protected by this - * OOM-during-evac-handler. The handler allows multiple threads to enter and exit - * evacuation path, but on OOME it requires all threads that experienced OOME to wait - * for current threads to leave, and blocks other threads from entering. - * - * Detailed state change: - * - * Upon entry of the evac-path, entering thread will attempt to increase the counter, - * using a CAS. Depending on the result of the CAS: - * - success: carry on with evac - * - failure: - * - if offending value is a valid counter, then try again - * - if offending value is OOM-during-evac special value: loop until - * counter drops to 0, then exit with resolving the ptr - * - * Upon exit, exiting thread will decrease the counter using atomic dec. - * - * Upon OOM-during-evac, any thread will attempt to CAS OOM-during-evac - * special value into the counter. Depending on result: - * - success: busy-loop until counter drops to zero, then exit with resolve - * - failure: - * - offender is valid counter update: try again - * - offender is OOM-during-evac: busy loop until counter drops to - * zero, then exit with resolve - */ -class ShenandoahEvacOOMHandler { -private: - static const jint OOM_MARKER_MASK; - - shenandoah_padding(0); - volatile jint _threads_in_evac; - shenandoah_padding(1); - - void wait_for_no_evac_threads(); - -public: - ShenandoahEvacOOMHandler(); - - /** - * Attempt to enter the protected evacuation path. - * - * When this returns true, it is safe to continue with normal evacuation. - * When this method returns false, evacuation must not be entered, and caller - * may safely continue with a simple resolve (if Java thread). - */ - void enter_evacuation(); - - /** - * Leave evacuation path. - */ - void leave_evacuation(); - - /** - * Signal out-of-memory during evacuation. It will prevent any other threads - * from entering the evacuation path, then wait until all threads have left the - * evacuation path, and then return. It is then safe to continue with a simple resolve. - */ - void handle_out_of_memory_during_evacuation(); - - void clear(); -}; - -class ShenandoahEvacOOMScope : public StackObj { -public: - ShenandoahEvacOOMScope(); - ~ShenandoahEvacOOMScope(); -}; - -#endif // SHARE_GC_SHENANDOAH_SHENANDOAHEVACOOMHANDLER_HPP diff -r d2738e1be37a src/hotspot/share/gc/shenandoah/shenandoahForwarding.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahForwarding.hpp Mon Apr 06 20:35:50 2020 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahForwarding.hpp Tue Apr 07 19:46:56 2020 +0200 @@ -62,6 +62,8 @@ */ static inline oop try_update_forwardee(oop obj, oop update); + static inline oop try_forward_to_self(oop obj); + }; #endif // SHARE_GC_SHENANDOAH_SHENANDOAHFORWARDING_HPP diff -r d2738e1be37a src/hotspot/share/gc/shenandoah/shenandoahForwarding.inline.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahForwarding.inline.hpp Mon Apr 06 20:35:50 2020 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahForwarding.inline.hpp Tue Apr 07 19:46:56 2020 +0200 @@ -76,16 +76,37 @@ inline oop ShenandoahForwarding::try_update_forwardee(oop obj, oop update) { markWord old_mark = obj->mark_raw(); - if (old_mark.is_marked()) { - return oop(old_mark.clear_lock_bits().to_pointer()); + while (true) { + if (old_mark.is_marked()) { + return oop(old_mark.clear_lock_bits().to_pointer()); + } + if ((old_mark.age() & markWord::max_age) == markWord::max_age) { + return obj; + } + markWord new_mark = markWord::encode_pointer_as_mark(update); + markWord prev_mark = obj->cas_set_mark_raw(new_mark, old_mark); + if (prev_mark == old_mark) { + return update; + } + old_mark = prev_mark; } +} - markWord new_mark = markWord::encode_pointer_as_mark(update); - markWord prev_mark = obj->cas_set_mark_raw(new_mark, old_mark); - if (prev_mark == old_mark) { - return update; - } else { - return oop(prev_mark.clear_lock_bits().to_pointer()); +inline oop ShenandoahForwarding::try_forward_to_self(oop obj) { + markWord old_mark = obj->mark_raw(); + while (true) { + if (old_mark.is_marked()) { + return oop(old_mark.clear_lock_bits().to_pointer()); + } + if ((old_mark.age() & markWord::max_age) == markWord::max_age) { + return obj; + } + markWord new_mark = old_mark.set_age(markWord::max_age); + markWord prev_mark = obj->cas_set_mark_raw(new_mark, old_mark); + if (prev_mark == old_mark) { + return obj; + } + old_mark = prev_mark; } } diff -r d2738e1be37a src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Mon Apr 06 20:35:50 2020 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Tue Apr 07 19:46:56 2020 +0200 @@ -956,12 +956,10 @@ void work(uint worker_id) { if (_concurrent) { ShenandoahConcurrentWorkerSession worker_session(worker_id); - ShenandoahSuspendibleThreadSetJoiner stsj(ShenandoahSuspendibleWorkers); - ShenandoahEvacOOMScope oom_evac_scope; + SuspendibleThreadSetJoiner stsj(ShenandoahSuspendibleWorkers); do_work(); } else { ShenandoahParallelWorkerSession worker_session(worker_id); - ShenandoahEvacOOMScope oom_evac_scope; do_work(); } } @@ -1066,7 +1064,6 @@ void work(uint worker_id) { ShenandoahParallelWorkerSession worker_session(worker_id); - ShenandoahEvacOOMScope oom_evac_scope; ShenandoahEvacuateUpdateRootsClosure<> cl; MarkingCodeBlobClosure blobsCl(&cl, CodeBlobToOopClosure::FixRelocations); _rp->roots_do(worker_id, &cl); @@ -1640,7 +1637,6 @@ } void work(uint worker_id) { - ShenandoahEvacOOMScope oom; { // vm_roots and weak_roots are OopStorage backed roots, concurrent iteration // may race against OopStorage::release() calls. @@ -1751,7 +1747,6 @@ } void work(uint worker_id) { - ShenandoahEvacOOMScope oom; // jni_roots and weak_roots are OopStorage backed roots, concurrent iteration // may race against OopStorage::release() calls. ShenandoahEvacUpdateCleanupOopStorageRootsClosure cl; @@ -2357,7 +2352,7 @@ void work(uint worker_id) { if (_concurrent) { ShenandoahConcurrentWorkerSession worker_session(worker_id); - ShenandoahSuspendibleThreadSetJoiner stsj(ShenandoahSuspendibleWorkers); + SuspendibleThreadSetJoiner stsj(ShenandoahSuspendibleWorkers); do_work(); } else { ShenandoahParallelWorkerSession worker_session(worker_id); @@ -2902,14 +2897,6 @@ return _memory_pool->get_memory_usage(); } -void ShenandoahHeap::enter_evacuation() { - _oom_evac_handler.enter_evacuation(); -} - -void ShenandoahHeap::leave_evacuation() { - _oom_evac_handler.leave_evacuation(); -} - ShenandoahRegionIterator::ShenandoahRegionIterator() : _heap(ShenandoahHeap::heap()), _index(0) {} diff -r d2738e1be37a src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Mon Apr 06 20:35:50 2020 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Tue Apr 07 19:46:56 2020 +0200 @@ -31,7 +31,6 @@ #include "gc/shenandoah/shenandoahAsserts.hpp" #include "gc/shenandoah/shenandoahAllocRequest.hpp" #include "gc/shenandoah/shenandoahLock.hpp" -#include "gc/shenandoah/shenandoahEvacOOMHandler.hpp" #include "gc/shenandoah/shenandoahPadding.hpp" #include "gc/shenandoah/shenandoahSharedVariables.hpp" #include "gc/shenandoah/shenandoahUnload.hpp" @@ -658,7 +657,6 @@ // private: ShenandoahCollectionSet* _collection_set; - ShenandoahEvacOOMHandler _oom_evac_handler; void evacuate_and_update_roots(); @@ -677,10 +675,6 @@ // by this thread, or by some other thread. inline oop evacuate_object(oop src, Thread* thread); - // Call before/after evacuation. - void enter_evacuation(); - void leave_evacuation(); - // ---------- Helper functions // public: diff -r d2738e1be37a src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp Mon Apr 06 20:35:50 2020 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp Tue Apr 07 19:46:56 2020 +0200 @@ -223,7 +223,6 @@ inline void ShenandoahHeap::clear_cancelled_gc() { _cancelled_gc.set(CANCELLABLE); - _oom_evac_handler.clear(); } inline HeapWord* ShenandoahHeap::allocate_from_gclab(Thread* thread, size_t size) { @@ -245,14 +244,6 @@ } inline oop ShenandoahHeap::evacuate_object(oop p, Thread* thread) { - if (ShenandoahThreadLocalData::is_oom_during_evac(Thread::current())) { - // This thread went through the OOM during evac protocol and it is safe to return - // the forward pointer. It must not attempt to evacuate any more. - return ShenandoahBarrierSet::resolve_forwarded(p); - } - - assert(ShenandoahThreadLocalData::is_evac_allowed(thread), "must be enclosed in oom-evac scope"); - size_t size = p->size(); assert(!heap_region_containing(p)->is_humongous(), "never evacuate humongous objects"); @@ -280,10 +271,7 @@ if (copy == NULL) { control_thread()->handle_alloc_failure_evac(size); - - _oom_evac_handler.handle_out_of_memory_during_evacuation(); - - return ShenandoahBarrierSet::resolve_forwarded(p); + return ShenandoahForwarding::try_forward_to_self(p); } // Copy the object: diff -r d2738e1be37a src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp Mon Apr 06 20:35:50 2020 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp Tue Apr 07 19:46:56 2020 +0200 @@ -214,7 +214,6 @@ data->oops_do(&cl); } } else if (heap->is_concurrent_root_in_progress()) { - ShenandoahEvacOOMScope evac_scope; ShenandoahEvacuateUpdateRootsClosure<> cl; data->oops_do(&cl, true /*fix relocation*/); } else { diff -r d2738e1be37a src/hotspot/share/gc/shenandoah/shenandoahParallelCleaning.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahParallelCleaning.cpp Mon Apr 06 20:35:50 2020 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahParallelCleaning.cpp Tue Apr 07 19:46:56 2020 +0200 @@ -27,7 +27,6 @@ #include "gc/shenandoah/shenandoahClosures.inline.hpp" #include "gc/shenandoah/shenandoahCodeRoots.hpp" -#include "gc/shenandoah/shenandoahEvacOOMHandler.hpp" #include "gc/shenandoah/shenandoahParallelCleaning.hpp" #include "runtime/safepoint.hpp" diff -r d2738e1be37a src/hotspot/share/gc/shenandoah/shenandoahThreadLocalData.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahThreadLocalData.hpp Mon Apr 06 20:35:50 2020 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahThreadLocalData.hpp Tue Apr 07 19:46:56 2020 +0200 @@ -39,7 +39,6 @@ private: char _gc_state; - char _oom_during_evac; ShenandoahSATBMarkQueue _satb_mark_queue; PLAB* _gclab; size_t _gclab_size; @@ -49,7 +48,6 @@ ShenandoahThreadLocalData() : _gc_state(0), - _oom_during_evac(0), _satb_mark_queue(&ShenandoahBarrierSet::satb_mark_queue_set()), _gclab(NULL), _gclab_size(0), @@ -85,18 +83,6 @@ return data(thread)->_satb_mark_queue; } - static bool is_oom_during_evac(Thread* thread) { - return (data(thread)->_oom_during_evac & 1) == 1; - } - - static void set_oom_during_evac(Thread* thread, bool oom) { - if (oom) { - data(thread)->_oom_during_evac |= 1; - } else { - data(thread)->_oom_during_evac &= ~1; - } - } - static void set_gc_state(Thread* thread, char gc_state) { data(thread)->_gc_state = gc_state; } @@ -147,20 +133,6 @@ data(thread)->_disarmed_value = value; } -#ifdef ASSERT - static void set_evac_allowed(Thread* thread, bool evac_allowed) { - if (evac_allowed) { - data(thread)->_oom_during_evac |= 2; - } else { - data(thread)->_oom_during_evac &= ~2; - } - } - - static bool is_evac_allowed(Thread* thread) { - return (data(thread)->_oom_during_evac & 2) == 2; - } -#endif - // Offsets static ByteSize satb_mark_queue_active_offset() { return satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active(); diff -r d2738e1be37a src/hotspot/share/gc/shenandoah/shenandoahUtils.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahUtils.hpp Mon Apr 06 20:35:50 2020 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahUtils.hpp Tue Apr 07 19:46:56 2020 +0200 @@ -148,28 +148,4 @@ ~ShenandoahParallelWorkerSession(); }; -class ShenandoahSuspendibleThreadSetJoiner { -private: - SuspendibleThreadSetJoiner _joiner; -public: - ShenandoahSuspendibleThreadSetJoiner(bool active = true) : _joiner(active) { - assert(!ShenandoahThreadLocalData::is_evac_allowed(Thread::current()), "STS should be joined before evac scope"); - } - ~ShenandoahSuspendibleThreadSetJoiner() { - assert(!ShenandoahThreadLocalData::is_evac_allowed(Thread::current()), "STS should be left after evac scope"); - } -}; - -class ShenandoahSuspendibleThreadSetLeaver { -private: - SuspendibleThreadSetLeaver _leaver; -public: - ShenandoahSuspendibleThreadSetLeaver(bool active = true) : _leaver(active) { - assert(!ShenandoahThreadLocalData::is_evac_allowed(Thread::current()), "STS should be left after evac scope"); - } - ~ShenandoahSuspendibleThreadSetLeaver() { - assert(!ShenandoahThreadLocalData::is_evac_allowed(Thread::current()), "STS should be joined before evac scope"); - } -}; - #endif // SHARE_GC_SHENANDOAH_SHENANDOAHUTILS_HPP