< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp

Print this page

        

*** 228,245 **** } else { return obj; } } ! oop ShenandoahBarrierSet::load_reference_barrier_mutator(oop obj) { assert(ShenandoahLoadRefBarrier, "should be enabled"); ! assert(_heap->is_gc_in_progress_mask(ShenandoahHeap::EVACUATION | ShenandoahHeap::TRAVERSAL), "evac should be in progress"); ! shenandoah_assert_in_cset(NULL, obj); oop fwd = resolve_forwarded_not_null(obj); if (oopDesc::equals_raw(obj, fwd)) { ShenandoahEvacOOMScope oom_evac_scope; Thread* thread = Thread::current(); oop res_oop = _heap->evacuate_object(obj, thread); --- 228,255 ---- } else { return obj; } } + oop ShenandoahBarrierSet::load_reference_barrier_mutator(oop obj, oop* load_addr) { + return load_reference_barrier_mutator_work(obj, load_addr); + } + + oop ShenandoahBarrierSet::load_reference_barrier_mutator(oop obj, narrowOop* load_addr) { + return load_reference_barrier_mutator_work(obj, load_addr); + } ! template <class T> ! oop ShenandoahBarrierSet::load_reference_barrier_mutator_work(oop obj, T* load_addr) { assert(ShenandoahLoadRefBarrier, "should be enabled"); ! shenandoah_assert_in_cset(load_addr, obj); oop fwd = resolve_forwarded_not_null(obj); if (oopDesc::equals_raw(obj, fwd)) { + assert(_heap->is_gc_in_progress_mask(ShenandoahHeap::EVACUATION | ShenandoahHeap::TRAVERSAL), + "evac should be in progress"); + ShenandoahEvacOOMScope oom_evac_scope; Thread* thread = Thread::current(); oop res_oop = _heap->evacuate_object(obj, thread);
*** 271,282 **** } cur = cur + cur_oop->size(); } } ! return res_oop; } return fwd; } oop ShenandoahBarrierSet::load_reference_barrier_impl(oop obj) { assert(ShenandoahLoadRefBarrier, "should be enabled"); --- 281,298 ---- } cur = cur + cur_oop->size(); } } ! fwd = res_oop; } + + if (load_addr != NULL && fwd != obj) { + // Since we are here and we know the load address, update the reference. + ShenandoahHeap::cas_oop(fwd, load_addr, obj); + } + return fwd; } oop ShenandoahBarrierSet::load_reference_barrier_impl(oop obj) { assert(ShenandoahLoadRefBarrier, "should be enabled");
< prev index next >