diff -r 377dcf569920 -r fb53a1c25903 src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Mon Apr 15 12:54:12 2019 -0400 +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Mon Apr 15 13:07:06 2019 -0400 @@ -33,6 +33,7 @@ #include "gc/shenandoah/shenandoahAllocTracker.hpp" #include "gc/shenandoah/shenandoahBarrierSet.hpp" #include "gc/shenandoah/shenandoahBrooksPointer.hpp" +#include "gc/shenandoah/shenandoahClosures.inline.hpp" #include "gc/shenandoah/shenandoahCollectionSet.hpp" #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" #include "gc/shenandoah/shenandoahConcurrentMark.inline.hpp" @@ -70,8 +71,6 @@ #include "runtime/vmThread.hpp" #include "services/mallocTracker.hpp" -ShenandoahUpdateRefsClosure::ShenandoahUpdateRefsClosure() : _heap(ShenandoahHeap::heap()) {} - #ifdef ASSERT template void ShenandoahAssertToSpaceClosure::do_oop_work(T* p) { @@ -940,43 +939,6 @@ return CollectedHeap::min_dummy_object_size() + ShenandoahBrooksPointer::word_size(); } -class ShenandoahEvacuateUpdateRootsClosure: public BasicOopIterateClosure { -private: - ShenandoahHeap* _heap; - Thread* _thread; -public: - ShenandoahEvacuateUpdateRootsClosure() : - _heap(ShenandoahHeap::heap()), _thread(Thread::current()) { - } - -private: - template - void do_oop_work(T* p) { - assert(_heap->is_evacuation_in_progress(), "Only do this when evacuation is in progress"); - - T o = RawAccess<>::oop_load(p); - if (! CompressedOops::is_null(o)) { - oop obj = CompressedOops::decode_not_null(o); - if (_heap->in_collection_set(obj)) { - shenandoah_assert_marked(p, obj); - oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj); - if (oopDesc::equals_raw(resolved, obj)) { - resolved = _heap->evacuate_object(obj, _thread); - } - RawAccess::oop_store(p, resolved); - } - } - } - -public: - void do_oop(oop* p) { - do_oop_work(p); - } - void do_oop(narrowOop* p) { - do_oop_work(p); - } -}; - class ShenandoahConcurrentEvacuateRegionObjectClosure : public ObjectClosure { private: ShenandoahHeap* const _heap; @@ -1884,31 +1846,6 @@ return result; } -ShenandoahForwardedIsAliveClosure::ShenandoahForwardedIsAliveClosure() : - _mark_context(ShenandoahHeap::heap()->marking_context()) { -} - -ShenandoahIsAliveClosure::ShenandoahIsAliveClosure() : - _mark_context(ShenandoahHeap::heap()->marking_context()) { -} - -bool ShenandoahForwardedIsAliveClosure::do_object_b(oop obj) { - if (CompressedOops::is_null(obj)) { - return false; - } - obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj); - shenandoah_assert_not_forwarded_if(NULL, obj, ShenandoahHeap::heap()->is_concurrent_mark_in_progress() || ShenandoahHeap::heap()->is_concurrent_traversal_in_progress()); - return _mark_context->is_marked(obj); -} - -bool ShenandoahIsAliveClosure::do_object_b(oop obj) { - if (CompressedOops::is_null(obj)) { - return false; - } - shenandoah_assert_not_forwarded(NULL, obj); - return _mark_context->is_marked(obj); -} - void ShenandoahHeap::ref_processing_init() { assert(_max_workers > 0, "Sanity"); @@ -2879,8 +2816,3 @@ ptrdiff_t ShenandoahHeap::cell_header_size() const { return ShenandoahBrooksPointer::byte_size(); } - -BoolObjectClosure* ShenandoahIsAliveSelector::is_alive_closure() { - return ShenandoahHeap::heap()->has_forwarded_objects() ? reinterpret_cast(&_fwd_alive_cl) - : reinterpret_cast(&_alive_cl); -}