JVMTI is notified after a virtual thread unmounts. Right not, this notification 
is done after the virtual thread has finished parking or yielding so it's 
possible for the virtual to continue, and be mounted on a different carrier, 
before the unmount notification has completed on the original carrier. If this 
happens it means the the JVMTI mount and unmount notifications will race and 
it's possible they could be unbalanced. The unmount notification needs to move 
to after the unmount and before the virtual thread state is changed.

While in the area, I've removed @ChangesCurrentThread from VirtualThread.run. 
This annotation was in place to workaround an issue with the notifyJvmtiXXX 
instrinsics, fixed recently by JDK-8316130.

Testing: tier1-6.

-------------

Commit messages:
 - Initial commit

Changes: https://git.openjdk.org/jdk/pull/16194/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16194&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8312777
  Stats: 28 lines in 1 file changed: 9 ins; 10 del; 9 mod
  Patch: https://git.openjdk.org/jdk/pull/16194.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16194/head:pull/16194

PR: https://git.openjdk.org/jdk/pull/16194

Reply via email to