< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahBarrierSetClone.inline.hpp

Print this page




  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(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()) {
  69   }




  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(cast_from_oop<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()) {
  69   }


< prev index next >