8225483: Shenandoah: Enhance native access barrier

Reviewed-by: rkennke
This commit is contained in:
Zhengyu Gu 2019-07-15 11:23:05 -04:00
parent 116af970c8
commit 5b05ea5a02
3 changed files with 22 additions and 1 deletions

View File

@ -360,5 +360,14 @@ void ShenandoahBarrierSet::on_thread_detach(Thread *thread) {
}
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);
}

View File

@ -179,6 +179,10 @@ public:
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);

View File

@ -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"
@ -86,6 +87,13 @@ inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_st
oop_store_in_heap(AccessInternal::oop_field_addr<decorators>(base, offset), value);
}
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) {