# Issue

`compiler/ciReplay/TestInliningProtectionDomain.java` fails with virtual 
threads because it expects method `bar()` not to be inlined (1 line in the log) 
but it gets inlined instead (5 lines in the log for `bar()` and the cascade of 
methods inside `bar()`).

# Cause

`bar()` relies on `java.lang.Thread` not being loaded but the VM seems to be 
loading it early on with virtual threads enabled. Apparently this happens 
because JTreg uses a _Virtual ThreadFactory_ to create virtual threads and this 
references the `Thread` class and make it resolve early. So, when C2 compiles 
`ProtectionDomainTestNoOtherCompilationPrivate::test()`, `Thread` is already 
resolved and the `bar()` inline succeeds.

# Fix

To fix this we can rely on another non-virtual-thread-sensitive `java.lang` 
class to be returned instead of `Thread`, e.g. `Record`.

# Testing
Tier 1-3+

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

Commit messages:
 - JDK-8374954: copyright year
 - JDK-8374954: add new line
 - Merge branch 'lworld' into JDK-8374954
 - JDK-8374954: [lworld] compiler/ciReplay/TestInliningProtectionDomain.java 
fails with virtual threads

Changes: https://git.openjdk.org/valhalla/pull/2060/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=2060&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8374954
  Stats: 8 lines in 2 files changed: 0 ins; 1 del; 7 mod
  Patch: https://git.openjdk.org/valhalla/pull/2060.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2060/head:pull/2060

PR: https://git.openjdk.org/valhalla/pull/2060

Reply via email to