> This is an update to the Virtual thread implementation that we'd like to 
> integrate in advance of JEP 491.
> 
> The update removes the use of  "temporary transitions", basically cases where 
> the thread identity switches to the carrier thread to do something in the 
> context of the carrier while a virtual thread is mounted. These cases create 
> complexity for JVMTI and observability tools. It has also attracted attention 
> in the review of the JEP 491 implementation as the object monitor changes 
> have to deal with the possibility of entering monitors while in this state. 
> There are 3 usages changes:
> 
> 1. In submitRunContinuation the submit to the scheduler is changed so that it 
> executes in the context of a virtual thread for cases where one virtual 
> thread unparks another. This requires pinning to prevent preemption during 
> this sensitive operation. ForkJoinPool.poolSubmit is changed so that it uses 
> the identity of the carrier. This change has no impact on the uses of 
> lazySubmit or externalSubmit.
> 2. Timed-park. The current implementation schedules/cancels the timer task 
> with the virtual thread mounted. This runs in the context of the carrier as 
> any contention would infer with thread state, park blocker and the parking 
> permit. The implementation is changed to schedule the timeout after 
> unmounting, and to cancel before re-mounting. The downside of this is that it 
> will scheduled later (maybe 200us later than before). We could capture the 
> time and adjust but it doesn't seem worth it.
> 3. jdk.tracePinnedThreads. This is a diagnostic option for finding usages of 
> thread locals in code executed by virtual threads. This is changed so use a 
> thread local to detect reentrancy.
> 
> The changes means that notifyJvmtiHideFrames, its intrinsic, and the JVMTI 
> "tmp VTMS_transition" bit go away.

Alan Bateman has updated the pull request with a new target base due to a merge 
or a rebase. The incremental webrev excludes the unrelated changes brought in 
by the merge/rebase. The pull request contains four additional commits since 
the last revision:

 - Fix typo in comment
 - Merge branch 'master' into JDK-8343132
 - Merge branch 'master' into JDK-8343132
 - Initial commit

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/21735/files
  - new: https://git.openjdk.org/jdk/pull/21735/files/c88ce3dd..2d18c116

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=21735&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=21735&range=00-01

  Stats: 54557 lines in 1036 files changed: 11998 ins; 40288 del; 2271 mod
  Patch: https://git.openjdk.org/jdk/pull/21735.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21735/head:pull/21735

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

Reply via email to