< prev index next >

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

Print this page
rev 56771 : 8233339: Shenandoah: Centralize load barrier decisions into ShenandoahBarrierSet

*** 25,34 **** --- 25,35 ---- #include "gc/shenandoah/shenandoahAsserts.hpp" #include "gc/shenandoah/shenandoahBarrierSet.hpp" #include "gc/shenandoah/shenandoahBarrierSetClone.inline.hpp" #include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp" #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" + #include "gc/shenandoah/shenandoahConcurrentRoots.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeuristics.hpp" #include "gc/shenandoah/shenandoahTraversalGC.hpp" #include "memory/iterator.inline.hpp" #include "runtime/interfaceSupport.inline.hpp"
*** 69,78 **** --- 70,109 ---- bool ShenandoahBarrierSet::is_aligned(HeapWord* hw) { return true; } + bool ShenandoahBarrierSet::need_load_reference_barrier(DecoratorSet decorators, BasicType type) { + if (!ShenandoahLoadRefBarrier) return false; + // Only needed for references + if (!is_reference_type(type)) return false; + return true; + } + + bool ShenandoahBarrierSet::use_native_load_reference_barrier(DecoratorSet decorators, BasicType type) { + assert(need_load_reference_barrier(decorators, type), "Why ask?"); + assert(is_reference_type(type), "Why we here?"); + // Native load reference barrier is only needed for concurrent root processing + if (!ShenandoahConcurrentRoots::can_do_concurrent_roots()) { + return false; + } + + return (decorators & IN_NATIVE) != 0; + } + + bool ShenandoahBarrierSet::need_keep_alive_barrier(DecoratorSet decorators,BasicType type) { + if (!ShenandoahKeepAliveBarrier) return false; + // Only needed for references + if (!is_reference_type(type)) return false; + + bool keep_alive = (decorators & AS_NO_KEEPALIVE) == 0; + bool unknown = (decorators & ON_UNKNOWN_OOP_REF) != 0; + bool is_traversal_mode = ShenandoahHeap::heap()->is_traversal_mode(); + bool on_weak_ref = (decorators & (ON_WEAK_OOP_REF | ON_PHANTOM_OOP_REF)) != 0; + return (on_weak_ref || unknown) && (keep_alive || is_traversal_mode); + } + template <class T> inline void ShenandoahBarrierSet::inline_write_ref_field_pre(T* field, oop new_val) { shenandoah_assert_not_in_cset_loc_except(field, _heap->cancelled_gc()); if (_heap->is_concurrent_mark_in_progress()) { T heap_oop = RawAccess<>::oop_load(field);
< prev index next >