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

Reviewed-by: wkemper, rkennke, heidinga, phh
  • Loading branch information
ashu-mehra authored and Paul Hohensee committed Sep 23, 2022
1 parent 543851d commit 3675f4c
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,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 @@ -1348,7 +1348,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

3 comments on commit 3675f4c

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@earthling-amzn
Copy link
Contributor

Choose a reason for hiding this comment

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

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 3675f4c Jun 15, 2023

Choose a reason for hiding this comment

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

@earthling-amzn the backport was successfully created on the branch earthling-amzn-backport-3675f4c2 in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 3675f4c2 from the openjdk/jdk repository.

The commit being backported was authored by Ashutosh Mehra on 23 Sep 2022 and was reviewed by William Kemper, Roman Kennke, Dan Heidinga and Paul Hohensee.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev.git earthling-amzn-backport-3675f4c2:earthling-amzn-backport-3675f4c2
$ git checkout earthling-amzn-backport-3675f4c2
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev.git earthling-amzn-backport-3675f4c2

Please sign in to comment.