8255527: Shenandoah: Let ShenadoahGCStateResetter disable barriers

Reviewed-by: shade, zgu
This commit is contained in:
Roman Kennke 2020-10-28 12:14:44 +00:00
parent 3c4fc79326
commit 1f00c3b9ba
2 changed files with 8 additions and 5 deletions

View File

@ -41,15 +41,17 @@
#include "utilities/debug.hpp" #include "utilities/debug.hpp"
ShenandoahGCStateResetter::ShenandoahGCStateResetter() : ShenandoahGCStateResetter::ShenandoahGCStateResetter() :
_gc_state(ShenandoahHeap::heap()->gc_state()), _heap(ShenandoahHeap::heap()),
_gc_state(_heap->gc_state()),
_concurrent_weak_root_in_progress(ShenandoahHeap::heap()->is_concurrent_weak_root_in_progress()) { _concurrent_weak_root_in_progress(ShenandoahHeap::heap()->is_concurrent_weak_root_in_progress()) {
_heap->_gc_state.clear();
_heap->set_concurrent_weak_root_in_progress(false);
} }
ShenandoahGCStateResetter::~ShenandoahGCStateResetter() { ShenandoahGCStateResetter::~ShenandoahGCStateResetter() {
ShenandoahHeap* const heap = ShenandoahHeap::heap(); _heap->_gc_state.set(_gc_state);
heap->_gc_state.set(_gc_state); assert(_heap->gc_state() == _gc_state, "Should be restored");
assert(heap->gc_state() == _gc_state, "Should be restored"); _heap->set_concurrent_weak_root_in_progress(_concurrent_weak_root_in_progress);
heap->set_concurrent_weak_root_in_progress(_concurrent_weak_root_in_progress);
} }
// Check for overflow of number of root types. // Check for overflow of number of root types.

View File

@ -30,6 +30,7 @@
class ShenandoahGCStateResetter : public StackObj { class ShenandoahGCStateResetter : public StackObj {
private: private:
ShenandoahHeap* const _heap;
const char _gc_state; const char _gc_state;
const bool _concurrent_weak_root_in_progress; const bool _concurrent_weak_root_in_progress;