8293252: Shenandoah: ThreadMXBean synchronizer tests crash with aggressive heuristics

Reviewed-by: wkemper, rkennke, heidinga, phh
This commit is contained in:
Ashutosh Mehra 2022-09-23 18:52:49 +00:00 committed by Paul Hohensee
parent 543851db92
commit 3675f4c2af
3 changed files with 14 additions and 6 deletions

View File

@ -133,6 +133,10 @@ public:
class AccessBarrier: public BarrierSet::AccessBarrier<decorators, BarrierSetT> {
typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw;
private:
template <typename T>
static void oop_store_common(T* addr, oop value);
public:
// Heap oop accesses. These accessors get resolved when
// IN_HEAP is set (e.g. when using the HeapAccess API), it is
@ -174,7 +178,6 @@ public:
template <typename T>
static oop oop_atomic_xchg_not_in_heap(T* addr, oop new_value);
};
};

View File

@ -241,7 +241,7 @@ inline oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_loa
template <DecoratorSet decorators, typename BarrierSetT>
template <typename T>
inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_store_not_in_heap(T* addr, oop value) {
inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_store_common(T* addr, oop value) {
shenandoah_assert_marked_if(NULL, value, !CompressedOops::is_null(value) && ShenandoahHeap::heap()->is_evacuation_in_progress());
shenandoah_assert_not_in_cset_if(addr, value, value != NULL && !ShenandoahHeap::heap()->cancelled_gc());
ShenandoahBarrierSet* const bs = ShenandoahBarrierSet::barrier_set();
@ -250,14 +250,19 @@ inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_st
Raw::oop_store(addr, value);
}
template <DecoratorSet decorators, typename BarrierSetT>
template <typename T>
inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_store_not_in_heap(T* addr, oop value) {
oop_store_common(addr, value);
}
template <DecoratorSet decorators, typename BarrierSetT>
template <typename T>
inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_store_in_heap(T* addr, oop value) {
shenandoah_assert_not_in_cset_loc_except(addr, ShenandoahHeap::heap()->cancelled_gc());
shenandoah_assert_not_forwarded_except (addr, value, value == NULL || ShenandoahHeap::heap()->cancelled_gc() || !ShenandoahHeap::heap()->is_concurrent_mark_in_progress());
shenandoah_assert_not_in_cset_except (addr, value, value == NULL || ShenandoahHeap::heap()->cancelled_gc() || !ShenandoahHeap::heap()->is_concurrent_mark_in_progress());
oop_store_not_in_heap(addr, value);
oop_store_common(addr, value);
}
template <DecoratorSet decorators, typename BarrierSetT>

View File

@ -1238,7 +1238,7 @@ private:
// There may be dead oops in weak roots in concurrent root phase, do not touch them.
return;
}
obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
obj = ShenandoahBarrierSet::barrier_set()->load_reference_barrier(obj);
assert(oopDesc::is_oop(obj), "must be a valid oop");
if (!_bitmap->is_marked(obj)) {
@ -1348,7 +1348,7 @@ private:
// There may be dead oops in weak roots in concurrent root phase, do not touch them.
return;
}
obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
obj = ShenandoahBarrierSet::barrier_set()->load_reference_barrier(obj);
assert(oopDesc::is_oop(obj), "Must be a valid oop");
if (_bitmap->par_mark(obj)) {