src/hotspot/share/prims/jvmtiEventController.cpp
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 55005 9b70ebd131b4
child 58679 9c3209ff7550
--- a/src/hotspot/share/prims/jvmtiEventController.cpp	Thu Oct 17 20:27:44 2019 +0100
+++ b/src/hotspot/share/prims/jvmtiEventController.cpp	Thu Oct 17 20:53:35 2019 +0100
@@ -264,7 +264,7 @@
 
 
 VM_ChangeSingleStep::VM_ChangeSingleStep(bool on)
-  : _on(on != 0)
+  : _on(on)
 {
 }
 
@@ -331,18 +331,20 @@
 }
 
 
-// This change must always be occur when at a safepoint.
-// Being at a safepoint causes the interpreter to use the
-// safepoint dispatch table which we overload to find single
-// step points.  Just to be sure that it has been set, we
-// call notice_safepoints when turning on single stepping.
-// When we leave our current safepoint, should_post_single_step
-// will be checked by the interpreter, and the table kept
-// or changed accordingly.
+// When _on == true, we use the safepoint interpreter dispatch table
+// to allow us to find the single step points. Otherwise, we switch
+// back to the regular interpreter dispatch table.
+// Note: We call Interpreter::notice_safepoints() and ignore_safepoints()
+// in a VM_Operation to safely make the dispatch table switch. We
+// no longer rely on the safepoint mechanism to do any of this work
+// for us.
 void VM_ChangeSingleStep::doit() {
+  log_debug(interpreter, safepoint)("changing single step to '%s'", _on ? "on" : "off");
   JvmtiEventControllerPrivate::set_should_post_single_step(_on);
   if (_on) {
     Interpreter::notice_safepoints();
+  } else {
+    Interpreter::ignore_safepoints();
   }
 }