8340400: Shenandoah: Whitebox breakpoint GC requests may cause assertions

Reviewed-by: shade
This commit is contained in:
William Kemper 2024-09-19 17:55:23 +00:00
parent 15ae1155a1
commit 75d5e11777

View File

@ -371,6 +371,16 @@ void ShenandoahControlThread::request_gc(GCCause::Cause cause) {
}
void ShenandoahControlThread::handle_requested_gc(GCCause::Cause cause) {
// For normal requested GCs (System.gc) we want to block the caller. However,
// for whitebox requested GC, we want to initiate the GC and return immediately.
// The whitebox caller thread will arrange for itself to wait until the GC notifies
// it that has reached the requested breakpoint (phase in the GC).
if (cause == GCCause::_wb_breakpoint) {
_requested_gc_cause = cause;
_gc_requested.set();
return;
}
// Make sure we have at least one complete GC cycle before unblocking
// from the explicit GC request.
//
@ -390,9 +400,7 @@ void ShenandoahControlThread::handle_requested_gc(GCCause::Cause cause) {
_requested_gc_cause = cause;
_gc_requested.set();
if (cause != GCCause::_wb_breakpoint) {
ml.wait();
}
ml.wait();
current_gc_id = get_gc_id();
}
}