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"
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()) {
_heap->_gc_state.clear();
_heap->set_concurrent_weak_root_in_progress(false);
}
ShenandoahGCStateResetter::~ShenandoahGCStateResetter() {
ShenandoahHeap* const heap = ShenandoahHeap::heap();
heap->_gc_state.set(_gc_state);
assert(heap->gc_state() == _gc_state, "Should be restored");
heap->set_concurrent_weak_root_in_progress(_concurrent_weak_root_in_progress);
_heap->_gc_state.set(_gc_state);
assert(_heap->gc_state() == _gc_state, "Should be restored");
_heap->set_concurrent_weak_root_in_progress(_concurrent_weak_root_in_progress);
}
// Check for overflow of number of root types.

View File

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