--- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp Mon Jul 15 10:21:33 2019 +0800
+++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp Mon Jul 15 11:23:05 2019 -0400
@@ -360,5 +360,14 @@
}
oop ShenandoahBarrierSet::oop_load_from_native_barrier(oop obj) {
- return load_reference_barrier(obj);
+ if (CompressedOops::is_null(obj)) {
+ return NULL;
+ }
+
+ if (_heap->is_evacuation_in_progress() &&
+ !_heap->complete_marking_context()->is_marked(obj)) {
+ return NULL;
+ }
+
+ return load_reference_barrier_not_null(obj);
}
--- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp Mon Jul 15 10:21:33 2019 +0800
+++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp Mon Jul 15 11:23:05 2019 -0400
@@ -179,6 +179,10 @@
template <typename T>
static oop oop_load_not_in_heap(T* addr);
+ // Used for catching bad stores
+ template <typename T>
+ static void oop_store_not_in_heap(T* addr, oop value);
+
template <typename T>
static oop oop_atomic_cmpxchg_not_in_heap(oop new_value, T* addr, oop compare_value);
--- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp Mon Jul 15 10:21:33 2019 +0800
+++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp Mon Jul 15 11:23:05 2019 -0400
@@ -25,6 +25,7 @@
#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"
@@ -88,6 +89,13 @@
template <DecoratorSet decorators, typename BarrierSetT>
template <typename T>
+inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_store_not_in_heap(T* addr, oop value) {
+ shenandoah_assert_marked_if(NULL, value, !CompressedOops::is_null(value) && ShenandoahHeap::heap()->is_evacuation_in_progress());
+ Raw::oop_store(addr, value);
+}
+
+template <DecoratorSet decorators, typename BarrierSetT>
+template <typename T>
inline oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_cmpxchg_not_in_heap(oop new_value, T* addr, oop compare_value) {
oop res;
oop expected = compare_value;