[lworld] RFR: 8364579: [lworld] Null oop fields are not correctly handled in scalarized returns

Tobias Hartmann thartmann at openjdk.org
Fri Aug 22 16:59:30 UTC 2025


The test that I wrote for Virtual Thread support (see [JDK-8336845](https://bugs.openjdk.org/browse/JDK-8336845)) triggers various crashes even without Virtual Threads. The problem is that null fields in scalarized returns are not zeroed which makes the GC very unhappy. This affects both x86 as well as AArch64. I added a targeted regression test for this scenario.

I then noticed that the code that handles oop fields in scalarized returns at safepoints does not correctly handle the case when a value object is returned both in scalarized form **and** as oop:
https://github.com/openjdk/valhalla/blob/b2e518b7cf85527b90f34ba63bf5a1b775430cd0/src/hotspot/share/runtime/safepoint.cpp#L793-L803

I fixed this as well, see  changes in `InlineKlass::returned_inline_klass`.

While testing this fix, I found more issues on AArch64. After debugging for a few days straight, I found multiple issues and filed [JDK-8365996](https://bugs.openjdk.org/browse/JDK-8365996) as a follow-up. For now, I disabled the test on AArch64.

Thanks,
Tobias

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

Commit messages:
 - Restrict to x64 for now because there are more bugs on aarchh64
 - Merge branch 'lworld' into JDK-8364579
 - Missed to arg registers on AArch64
 - First draft
 - First draft

Changes: https://git.openjdk.org/valhalla/pull/1527/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=1527&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8364579
  Stats: 304 lines in 14 files changed: 273 ins; 5 del; 26 mod
  Patch: https://git.openjdk.org/valhalla/pull/1527.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1527/head:pull/1527

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


More information about the valhalla-dev mailing list