< prev index next >

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

Print this page




  37 
  38 template <class T, bool STRING_DEDUP, bool DEGEN>
  39 void ShenandoahTraversalGC::process_oop(T* p, Thread* thread, ShenandoahObjToScanQueue* queue, ShenandoahMarkingContext* const mark_context) {
  40   T o = RawAccess<>::oop_load(p);
  41   if (!CompressedOops::is_null(o)) {
  42     oop obj = CompressedOops::decode_not_null(o);
  43     if (DEGEN) {
  44       oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
  45       if (!oopDesc::equals_raw(obj, forw)) {
  46         // Update reference.
  47         RawAccess<IS_NOT_NULL>::oop_store(p, forw);
  48       }
  49       obj = forw;
  50     } else if (_heap->in_collection_set(obj)) {
  51       oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
  52       if (oopDesc::equals_raw(obj, forw)) {
  53         forw = _heap->evacuate_object(obj, thread);
  54       }
  55       shenandoah_assert_forwarded_except(p, obj, _heap->cancelled_gc());
  56       // Update reference.
  57       _heap->atomic_compare_exchange_oop(forw, p, obj);
  58       obj = forw;
  59     }
  60 
  61     shenandoah_assert_not_forwarded(p, obj);
  62     shenandoah_assert_not_in_cset_except(p, obj, _heap->cancelled_gc());
  63 
  64     if (mark_context->mark(obj)) {
  65       bool succeeded = queue->push(ShenandoahMarkTask(obj));
  66       assert(succeeded, "must succeed to push to task queue");
  67 
  68       if (STRING_DEDUP && ShenandoahStringDedup::is_candidate(obj) && !_heap->cancelled_gc()) {
  69         assert(ShenandoahStringDedup::is_enabled(), "Must be enabled");
  70         // Only dealing with to-space string, so that we can avoid evac-oom protocol, which is costly here.
  71         shenandoah_assert_not_in_cset(p, obj);
  72         ShenandoahStringDedup::enqueue_candidate(obj);
  73       }
  74     }
  75   }
  76 }
  77 


  37 
  38 template <class T, bool STRING_DEDUP, bool DEGEN>
  39 void ShenandoahTraversalGC::process_oop(T* p, Thread* thread, ShenandoahObjToScanQueue* queue, ShenandoahMarkingContext* const mark_context) {
  40   T o = RawAccess<>::oop_load(p);
  41   if (!CompressedOops::is_null(o)) {
  42     oop obj = CompressedOops::decode_not_null(o);
  43     if (DEGEN) {
  44       oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
  45       if (!oopDesc::equals_raw(obj, forw)) {
  46         // Update reference.
  47         RawAccess<IS_NOT_NULL>::oop_store(p, forw);
  48       }
  49       obj = forw;
  50     } else if (_heap->in_collection_set(obj)) {
  51       oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
  52       if (oopDesc::equals_raw(obj, forw)) {
  53         forw = _heap->evacuate_object(obj, thread);
  54       }
  55       shenandoah_assert_forwarded_except(p, obj, _heap->cancelled_gc());
  56       // Update reference.
  57       ShenandoahHeap::cas_oop(forw, p, obj);
  58       obj = forw;
  59     }
  60 
  61     shenandoah_assert_not_forwarded(p, obj);
  62     shenandoah_assert_not_in_cset_except(p, obj, _heap->cancelled_gc());
  63 
  64     if (mark_context->mark(obj)) {
  65       bool succeeded = queue->push(ShenandoahMarkTask(obj));
  66       assert(succeeded, "must succeed to push to task queue");
  67 
  68       if (STRING_DEDUP && ShenandoahStringDedup::is_candidate(obj) && !_heap->cancelled_gc()) {
  69         assert(ShenandoahStringDedup::is_enabled(), "Must be enabled");
  70         // Only dealing with to-space string, so that we can avoid evac-oom protocol, which is costly here.
  71         shenandoah_assert_not_in_cset(p, obj);
  72         ShenandoahStringDedup::enqueue_candidate(obj);
  73       }
  74     }
  75   }
  76 }
  77 
< prev index next >