From a395aa616813a1019c7f6cc394c878394a0b8af6 Mon Sep 17 00:00:00 2001 From: Kunshan Wang Date: Wed, 4 Aug 2021 18:56:34 +0800 Subject: [PATCH] Fix stop-the-world race. Added a VMOp_ThirdPartyHeapOperation for the third-party heap to perform stop-the-world GC. SafepointSynchronize::begin() no longer report "thread has stopped" to the third-party heap. Instead the third-party heap should scan stacks during stop-the-world. --- src/hotspot/share/runtime/safepoint.cpp | 1 - src/hotspot/share/runtime/vmOperations.hpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/runtime/safepoint.cpp b/src/hotspot/share/runtime/safepoint.cpp index 3b448a6e575..9175473eecd 100644 --- a/src/hotspot/share/runtime/safepoint.cpp +++ b/src/hotspot/share/runtime/safepoint.cpp @@ -294,7 +294,6 @@ void SafepointSynchronize::begin() { cur_state->examine_state_of_thread(); if (!cur_state->is_running()) { still_running--; - Universe::heap()->report_java_thread_yield(cur); // consider adjusting steps downward: // steps = 0 // steps -= NNN diff --git a/src/hotspot/share/runtime/vmOperations.hpp b/src/hotspot/share/runtime/vmOperations.hpp index 7f199ca0acd..b26db9a19c9 100644 --- a/src/hotspot/share/runtime/vmOperations.hpp +++ b/src/hotspot/share/runtime/vmOperations.hpp @@ -130,6 +130,7 @@ template(PrintMetadata) \ template(GTestExecuteAtSafepoint) \ template(JFROldObject) \ + template(ThirdPartyHeapOperation) \ class VM_Operation: public CHeapObj { public: