Skip to content

Commit 3675f4c

Browse files
ashu-mehraPaul Hohensee
authored and
Paul Hohensee
committedSep 23, 2022
8293252: Shenandoah: ThreadMXBean synchronizer tests crash with aggressive heuristics
Reviewed-by: wkemper, rkennke, heidinga, phh
1 parent 543851d commit 3675f4c

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed
 

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ class ShenandoahBarrierSet: public BarrierSet {
133133
class AccessBarrier: public BarrierSet::AccessBarrier<decorators, BarrierSetT> {
134134
typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw;
135135

136+
private:
137+
template <typename T>
138+
static void oop_store_common(T* addr, oop value);
139+
136140
public:
137141
// Heap oop accesses. These accessors get resolved when
138142
// IN_HEAP is set (e.g. when using the HeapAccess API), it is
@@ -174,7 +178,6 @@ class ShenandoahBarrierSet: public BarrierSet {
174178

175179
template <typename T>
176180
static oop oop_atomic_xchg_not_in_heap(T* addr, oop new_value);
177-
178181
};
179182

180183
};

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

+8-3
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ inline oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_loa
241241

242242
template <DecoratorSet decorators, typename BarrierSetT>
243243
template <typename T>
244-
inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_store_not_in_heap(T* addr, oop value) {
244+
inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_store_common(T* addr, oop value) {
245245
shenandoah_assert_marked_if(NULL, value, !CompressedOops::is_null(value) && ShenandoahHeap::heap()->is_evacuation_in_progress());
246246
shenandoah_assert_not_in_cset_if(addr, value, value != NULL && !ShenandoahHeap::heap()->cancelled_gc());
247247
ShenandoahBarrierSet* const bs = ShenandoahBarrierSet::barrier_set();
@@ -250,14 +250,19 @@ inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_st
250250
Raw::oop_store(addr, value);
251251
}
252252

253+
template <DecoratorSet decorators, typename BarrierSetT>
254+
template <typename T>
255+
inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_store_not_in_heap(T* addr, oop value) {
256+
oop_store_common(addr, value);
257+
}
258+
253259
template <DecoratorSet decorators, typename BarrierSetT>
254260
template <typename T>
255261
inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_store_in_heap(T* addr, oop value) {
256262
shenandoah_assert_not_in_cset_loc_except(addr, ShenandoahHeap::heap()->cancelled_gc());
257263
shenandoah_assert_not_forwarded_except (addr, value, value == NULL || ShenandoahHeap::heap()->cancelled_gc() || !ShenandoahHeap::heap()->is_concurrent_mark_in_progress());
258-
shenandoah_assert_not_in_cset_except (addr, value, value == NULL || ShenandoahHeap::heap()->cancelled_gc() || !ShenandoahHeap::heap()->is_concurrent_mark_in_progress());
259264

260-
oop_store_not_in_heap(addr, value);
265+
oop_store_common(addr, value);
261266
}
262267

263268
template <DecoratorSet decorators, typename BarrierSetT>

‎src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ class ObjectIterateScanRootClosure : public BasicOopIterateClosure {
12381238
// There may be dead oops in weak roots in concurrent root phase, do not touch them.
12391239
return;
12401240
}
1241-
obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
1241+
obj = ShenandoahBarrierSet::barrier_set()->load_reference_barrier(obj);
12421242

12431243
assert(oopDesc::is_oop(obj), "must be a valid oop");
12441244
if (!_bitmap->is_marked(obj)) {
@@ -1348,7 +1348,7 @@ class ShenandoahObjectIterateParScanClosure : public BasicOopIterateClosure {
13481348
// There may be dead oops in weak roots in concurrent root phase, do not touch them.
13491349
return;
13501350
}
1351-
obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
1351+
obj = ShenandoahBarrierSet::barrier_set()->load_reference_barrier(obj);
13521352

13531353
assert(oopDesc::is_oop(obj), "Must be a valid oop");
13541354
if (_bitmap->par_mark(obj)) {

0 commit comments

Comments
 (0)
Please sign in to comment.