diff --git a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp index a4353df545b..1d4dd7b9e3e 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp @@ -133,6 +133,10 @@ class ShenandoahBarrierSet: public BarrierSet { class AccessBarrier: public BarrierSet::AccessBarrier { typedef BarrierSet::AccessBarrier Raw; + private: + template + static void oop_store_common(T* addr, oop value); + public: // Heap oop accesses. These accessors get resolved when // IN_HEAP is set (e.g. when using the HeapAccess API), it is @@ -174,7 +178,6 @@ class ShenandoahBarrierSet: public BarrierSet { template static oop oop_atomic_xchg_not_in_heap(T* addr, oop new_value); - }; }; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp index 860e014f029..02da87ae916 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp @@ -241,7 +241,7 @@ inline oop ShenandoahBarrierSet::AccessBarrier::oop_loa template template -inline void ShenandoahBarrierSet::AccessBarrier::oop_store_not_in_heap(T* addr, oop value) { +inline void ShenandoahBarrierSet::AccessBarrier::oop_store_common(T* addr, oop value) { shenandoah_assert_marked_if(NULL, value, !CompressedOops::is_null(value) && ShenandoahHeap::heap()->is_evacuation_in_progress()); shenandoah_assert_not_in_cset_if(addr, value, value != NULL && !ShenandoahHeap::heap()->cancelled_gc()); ShenandoahBarrierSet* const bs = ShenandoahBarrierSet::barrier_set(); @@ -250,14 +250,19 @@ inline void ShenandoahBarrierSet::AccessBarrier::oop_st Raw::oop_store(addr, value); } +template +template +inline void ShenandoahBarrierSet::AccessBarrier::oop_store_not_in_heap(T* addr, oop value) { + oop_store_common(addr, value); +} + template template inline void ShenandoahBarrierSet::AccessBarrier::oop_store_in_heap(T* addr, oop value) { shenandoah_assert_not_in_cset_loc_except(addr, ShenandoahHeap::heap()->cancelled_gc()); shenandoah_assert_not_forwarded_except (addr, value, value == NULL || ShenandoahHeap::heap()->cancelled_gc() || !ShenandoahHeap::heap()->is_concurrent_mark_in_progress()); - shenandoah_assert_not_in_cset_except (addr, value, value == NULL || ShenandoahHeap::heap()->cancelled_gc() || !ShenandoahHeap::heap()->is_concurrent_mark_in_progress()); - oop_store_not_in_heap(addr, value); + oop_store_common(addr, value); } template diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index 17e0c5bab1c..0733cb96516 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -1244,7 +1244,7 @@ class ObjectIterateScanRootClosure : public BasicOopIterateClosure { // There may be dead oops in weak roots in concurrent root phase, do not touch them. return; } - obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj); + obj = ShenandoahBarrierSet::barrier_set()->load_reference_barrier(obj); assert(oopDesc::is_oop(obj), "must be a valid oop"); if (!_bitmap->is_marked(obj)) { @@ -1353,7 +1353,7 @@ class ShenandoahObjectIterateParScanClosure : public BasicOopIterateClosure { // There may be dead oops in weak roots in concurrent root phase, do not touch them. return; } - obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj); + obj = ShenandoahBarrierSet::barrier_set()->load_reference_barrier(obj); assert(oopDesc::is_oop(obj), "Must be a valid oop"); if (_bitmap->par_mark(obj)) {