8329103: assert(!thread->in_asgct()) failed during multi-mode profiling

Reviewed-by: dholmes, sspitsyn
This commit is contained in:
Andrei Pangin 2024-04-02 04:30:26 +00:00 committed by Serguei Spitsyn
parent bc546c21a5
commit 6b1b0e9d45

View File

@ -657,15 +657,17 @@ protected:
class ThreadInAsgct {
private:
Thread* _thread;
bool _saved_in_asgct;
public:
ThreadInAsgct(Thread* thread) : _thread(thread) {
assert(thread != nullptr, "invariant");
assert(!thread->in_asgct(), "invariant");
// Allow AsyncGetCallTrace to be reentrant - save the previous state.
_saved_in_asgct = thread->in_asgct();
thread->set_in_asgct(true);
}
~ThreadInAsgct() {
assert(_thread->in_asgct(), "invariant");
_thread->set_in_asgct(false);
_thread->set_in_asgct(_saved_in_asgct);
}
};