> The `interp-only` mechanism is based on the `JavaThread` objects. Carrier and 
> virtual threads can temporary share the same `JavaThread`. The 
> `java_thread->jvmti_thread_state()` is re-linked to a virtual thread at 
> `mount` and to the carrier thread at `unmount`. The `JvmtiThreadState` has a 
> back link to the `JavaThread` which is also set for virtual thread at a 
> `mount` and carrier thread at an `unmount`. Just one of these two links at 
> the same time is set to the `JavaThread`, the other one has to be set to 
> `nullptr`. The `interp-only` mechanism needs this invariant.
> However, there is a corner case when this invariant is broken. It happens 
> when the `JvmtiThreadState` for carrier thread has just been created. In such 
> case, the link to `JavaThread` is always `non-nullptr` even though a virtual 
> thread is currently mounted on a carrier thread. This simple update fixes the 
> issue in the  `JvmtiThreadState` ctor.
> 
> Testing:
>  - TBD: Mach5 tiers 1-6

Serguei Spitsyn 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 five additional 
commits since the last revision:

 - Merge
 - review: fixed minor typos in newly added comments
 - review: moved and extended comment in JvmtiThreadState ctor
 - review: some tweaks for carrier thread JvmtiThreadState initialization
 - 8373367: interp-only mechanism fails to work for carrier threads in a corner 
case

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/29436/files
  - new: https://git.openjdk.org/jdk/pull/29436/files/65784f93..61d16e80

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=29436&range=04
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29436&range=03-04

  Stats: 104163 lines in 1906 files changed: 49820 ins; 24938 del; 29405 mod
  Patch: https://git.openjdk.org/jdk/pull/29436.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29436/head:pull/29436

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

Reply via email to