< prev index next >

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

Print this page
rev 55317 : 8225483: Shenandoah: Enhance native access barrier

@@ -23,10 +23,11 @@
 
 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHBARRIERSET_INLINE_HPP
 #define SHARE_GC_SHENANDOAH_SHENANDOAHBARRIERSET_INLINE_HPP
 
 #include "gc/shared/barrierSet.hpp"
+#include "gc/shenandoah/shenandoahAsserts.hpp"
 #include "gc/shenandoah/shenandoahBarrierSet.hpp"
 #include "gc/shenandoah/shenandoahForwarding.inline.hpp"
 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
 #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp"

@@ -63,11 +64,21 @@
 
 template <DecoratorSet decorators, typename BarrierSetT>
 template <typename T>
 inline oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_load_not_in_heap(T* addr) {
   oop value = Raw::oop_load_not_in_heap(addr);
-  value = ShenandoahBarrierSet::barrier_set()->load_reference_barrier(value);
+  if (CompressedOops::is_null(value)) return value;
+
+  ShenandoahHeap* const heap = ShenandoahHeap::heap();
+  if (heap->is_evacuation_in_progress()) {
+    ShenandoahMarkingContext* const marking_context = heap->complete_marking_context();
+    if (!marking_context->is_marked(value)) {
+      return NULL;
+    }
+  }
+
+  value = ShenandoahBarrierSet::barrier_set()->load_reference_barrier_not_null(value);
   keep_alive_if_weak(decorators, value);
   return value;
 }
 
 template <DecoratorSet decorators, typename BarrierSetT>

@@ -79,10 +90,21 @@
     ShenandoahBarrierSet::barrier_set()->write_ref_field_pre_work(addr, value);
   }
   Raw::oop_store_in_heap(addr, value);
 }
 
+#ifdef ASSERT
+template <DecoratorSet decorators, typename BarrierSetT>
+template <typename T>
+inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_store_not_in_heap(T* addr, oop value) {
+  ShenandoahHeap* const heap = ShenandoahHeap::heap();
+  shenandoah_assert_marked_if(NULL, value, !CompressedOops::is_null(value) && heap->is_evacuation_in_progress());
+
+  Raw::oop_store(addr, value);
+}
+#endif
+
 template <DecoratorSet decorators, typename BarrierSetT>
 inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_store_in_heap_at(oop base, ptrdiff_t offset, oop value) {
   oop_store_in_heap(AccessInternal::oop_field_addr<decorators>(base, offset), value);
 }
 
< prev index next >