29 #include "gc/shenandoah/shenandoahCollectionSet.inline.hpp" 30 #include "gc/shenandoah/shenandoahEvacOOMHandler.hpp" 31 #include "gc/shenandoah/shenandoahHeap.inline.hpp" 32 #include "memory/iterator.hpp" 33 #include "oops/access.hpp" 34 #include "oops/compressedOops.hpp" 35 36 template <bool EVAC, bool ENQUEUE> 37 class ShenandoahUpdateRefsForOopClosure: public BasicOopIterateClosure { 38 private: 39 ShenandoahHeap* const _heap; 40 ShenandoahBarrierSet* const _bs; 41 const ShenandoahCollectionSet* const _cset; 42 Thread* const _thread; 43 44 template <class T> 45 inline void do_oop_work(T* p) { 46 T o = RawAccess<>::oop_load(p); 47 if (!CompressedOops::is_null(o)) { 48 oop obj = CompressedOops::decode_not_null(o); 49 if (_cset->is_in((HeapWord *)obj)) { 50 oop fwd = _bs->resolve_forwarded_not_null(obj); 51 if (EVAC && obj == fwd) { 52 fwd = _heap->evacuate_object(obj, _thread); 53 } 54 if (ENQUEUE) { 55 _bs->enqueue(fwd); 56 } 57 assert(obj != fwd || _heap->cancelled_gc(), "must be forwarded"); 58 ShenandoahHeap::cas_oop(fwd, p, o); 59 } 60 61 } 62 } 63 public: 64 ShenandoahUpdateRefsForOopClosure() : 65 _heap(ShenandoahHeap::heap()), 66 _bs(ShenandoahBarrierSet::barrier_set()), 67 _cset(_heap->collection_set()), 68 _thread(Thread::current()) { | 29 #include "gc/shenandoah/shenandoahCollectionSet.inline.hpp" 30 #include "gc/shenandoah/shenandoahEvacOOMHandler.hpp" 31 #include "gc/shenandoah/shenandoahHeap.inline.hpp" 32 #include "memory/iterator.hpp" 33 #include "oops/access.hpp" 34 #include "oops/compressedOops.hpp" 35 36 template <bool EVAC, bool ENQUEUE> 37 class ShenandoahUpdateRefsForOopClosure: public BasicOopIterateClosure { 38 private: 39 ShenandoahHeap* const _heap; 40 ShenandoahBarrierSet* const _bs; 41 const ShenandoahCollectionSet* const _cset; 42 Thread* const _thread; 43 44 template <class T> 45 inline void do_oop_work(T* p) { 46 T o = RawAccess<>::oop_load(p); 47 if (!CompressedOops::is_null(o)) { 48 oop obj = CompressedOops::decode_not_null(o); 49 assert_object_is_in_heap(p, obj); 50 51 if (_cset->is_in((HeapWord *)obj)) { 52 oop fwd = _bs->resolve_forwarded_not_null(obj); 53 if (EVAC && obj == fwd) { 54 fwd = _heap->evacuate_object(obj, _thread); 55 } 56 if (ENQUEUE) { 57 _bs->enqueue(fwd); 58 } 59 assert(obj != fwd || _heap->cancelled_gc(), "must be forwarded"); 60 ShenandoahHeap::cas_oop(fwd, p, o); 61 } 62 63 } 64 } 65 public: 66 ShenandoahUpdateRefsForOopClosure() : 67 _heap(ShenandoahHeap::heap()), 68 _bs(ShenandoahBarrierSet::barrier_set()), 69 _cset(_heap->collection_set()), 70 _thread(Thread::current()) { |