< prev index next >

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

Print this page
*** 51,11 ***
        if (HAS_FWD && _cset->is_in(obj)) {
          oop fwd = _bs->resolve_forwarded_not_null(obj);
          if (EVAC && obj == fwd) {
            fwd = _heap->evacuate_object(obj, _thread);
          }
!         assert(obj != fwd || _heap->cancelled_gc(), "must be forwarded");
          ShenandoahHeap::atomic_update_oop(fwd, p, o);
          obj = fwd;
        }
        if (ENQUEUE) {
          _bs->enqueue(obj);
--- 51,11 ---
        if (HAS_FWD && _cset->is_in(obj)) {
          oop fwd = _bs->resolve_forwarded_not_null(obj);
          if (EVAC && obj == fwd) {
            fwd = _heap->evacuate_object(obj, _thread);
          }
!         shenandoah_assert_forwarded_except(p, obj, _heap->cancelled_gc());
          ShenandoahHeap::atomic_update_oop(fwd, p, o);
          obj = fwd;
        }
        if (ENQUEUE) {
          _bs->enqueue(obj);

*** 102,12 ***
  
  void ShenandoahBarrierSet::clone_barrier(oop obj) {
    assert(ShenandoahCloneBarrier, "only get here with clone barriers enabled");
    shenandoah_assert_correct(nullptr, obj);
  
    int gc_state = _heap->gc_state();
!   if ((gc_state & ShenandoahHeap::MARKING) != 0) {
      clone_marking(obj);
    } else if ((gc_state & ShenandoahHeap::EVACUATION) != 0) {
      clone_evacuation(obj);
    } else {
      clone_update(obj);
--- 102,16 ---
  
  void ShenandoahBarrierSet::clone_barrier(oop obj) {
    assert(ShenandoahCloneBarrier, "only get here with clone barriers enabled");
    shenandoah_assert_correct(nullptr, obj);
  
+   // We only need to handle YOUNG_MARKING here because the clone barrier
+   // is only invoked during marking if Shenandoah is in incremental update
+   // mode. OLD_MARKING should only happen when Shenandoah is in generational
+   // mode, which uses the SATB write barrier.
    int gc_state = _heap->gc_state();
!   if ((gc_state & ShenandoahHeap::YOUNG_MARKING) != 0) {
      clone_marking(obj);
    } else if ((gc_state & ShenandoahHeap::EVACUATION) != 0) {
      clone_evacuation(obj);
    } else {
      clone_update(obj);
< prev index next >