Skip to content

Commit

Permalink
8293252: Shenandoah: ThreadMXBean synchronizer tests crash with aggre…
Browse files Browse the repository at this point in the history
…ssive heuristics

Backport-of: 3675f4c2afd10b5042948fc79e62caee5f3874ce
  • Loading branch information
William Kemper authored and shipilev committed Jun 19, 2023
1 parent 5a4e374 commit 249ddf4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp
Expand Up @@ -133,6 +133,10 @@ class ShenandoahBarrierSet: public BarrierSet {
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
Expand Down Expand Up @@ -174,7 +178,6 @@ class ShenandoahBarrierSet: public BarrierSet {

template <typename T>
static oop oop_atomic_xchg_not_in_heap(T* addr, oop new_value);

};

};
Expand Down
11 changes: 8 additions & 3 deletions src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp
Expand Up @@ -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();
Expand All @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
Expand Up @@ -1244,7 +1244,7 @@ class ObjectIterateScanRootClosure : public BasicOopIterateClosure {
// 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)) {
Expand Down Expand Up @@ -1353,7 +1353,7 @@ class ShenandoahObjectIterateParScanClosure : public BasicOopIterateClosure {
// 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)) {
Expand Down

1 comment on commit 249ddf4

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.