RFR: 8347463: jdk/jfr/threading/TestManyVirtualThreads.java crashes with assert(oopDesc::is_oop_or_null(val)) [v2]

Anton Seoane Ampudia aseoane at openjdk.org
Mon Oct 27 06:35:27 UTC 2025


> This PR introduces a fix for a intermittent assert crash due to a non-oop found in the stack when deoptimizing.
> 
> The `inline_native_GetEventWriter` JFR intrinsic performs a call into the runtime, which can safepoint, to write a checkpoint for the vthread. This call returns a global handle (`jobject`) that then gets resolved to a raw oop.
> 
> However, the corresponding `jfr_write_checkpoint_Type` does not set any return, modelling the call as `void`. If a safepoint hits in the small window after the stub returns but before the writer oop is used, and the GC moves the object in that window, the deoptimization path cannot resolve a handle that it never recorded, leading to the subsequent crash.
> 
> An IR Framework test is introduced to exercise the error explicitly. Additionally, related documentation in form of comments in the appropriate file (`runtime.hpp`) is added to hopefully prevent similar cases in the future.
> 
> **Testing:** passes tiers 1-5

Anton Seoane Ampudia 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 seven additional commits since the last revision:

 - Merge branch 'openjdk:master' into JDK-8347463
 - Merge branch 'JDK-8347463' of github.com:anton-seoane/jdk into JDK-8347463
 - Merge branch 'openjdk:master' into JDK-8347463
 - Documentation for future similar cases
 - Test for JDK-8347463
 - Change to a more specific type
 - Runtime call had void type but actually returned an object

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/27913/files
  - new: https://git.openjdk.org/jdk/pull/27913/files/a6225ebd..c85142ef

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

  Stats: 11497 lines in 242 files changed: 7821 ins; 2031 del; 1645 mod
  Patch: https://git.openjdk.org/jdk/pull/27913.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27913/head:pull/27913

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


More information about the hotspot-compiler-dev mailing list