8352918: Shenandoah: Verifier does not deactivate barriers as intended

Reviewed-by: kdnilsen, shade, ysr
This commit is contained in:
William Kemper 2025-03-27 16:34:19 +00:00
parent dc5c4148c7
commit 1bd0ce1f51
2 changed files with 11 additions and 4 deletions

View File

@ -46,13 +46,19 @@
ShenandoahGCStateResetter::ShenandoahGCStateResetter() :
_heap(ShenandoahHeap::heap()),
_gc_state(_heap->gc_state()) {
_saved_gc_state(_heap->gc_state()),
_saved_gc_state_changed(_heap->_gc_state_changed) {
// Clear state to deactivate barriers. Indicate that state has changed
// so that verifier threads will use this value, rather than thread local
// values (which we are _not_ changing here).
_heap->_gc_state.clear();
_heap->_gc_state_changed = true;
}
ShenandoahGCStateResetter::~ShenandoahGCStateResetter() {
_heap->_gc_state.set(_gc_state);
assert(_heap->gc_state() == _gc_state, "Should be restored");
_heap->_gc_state.set(_saved_gc_state);
_heap->_gc_state_changed = _saved_gc_state_changed;
assert(_heap->gc_state() == _saved_gc_state, "Should be restored");
}
void ShenandoahRootVerifier::roots_do(OopIterateClosure* oops) {

View File

@ -32,7 +32,8 @@
class ShenandoahGCStateResetter : public StackObj {
private:
ShenandoahHeap* const _heap;
const char _gc_state;
const char _saved_gc_state;
const bool _saved_gc_state_changed;
public:
ShenandoahGCStateResetter();