RFR: 8350148: Native stack overflow when writing Java heap objects into AOT cache

Ioi Lam iklam at openjdk.org
Sun Feb 16 05:21:00 UTC 2025


Please review this patch that fixes a problem that was found in the Leyden repo: when finding all cacheable heap objects with recursive calls to `HeapShared::archive_reachable_objects_from()`, very deep reference chains could cause overflow on the native stack. 

The fix is to do the recursion using a side table, without making any recursive calls.

Note: the kind of deep reference chains do not seem to happen with the mainline. It happened in the Leyden repo only after we enabled the caching of `WeakReference` objects, which are not cacheable in the mainline.

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

Commit messages:
 - 8350148: Native stack overflow when writing Java heap objects into AOT cache

Changes: https://git.openjdk.org/jdk/pull/23654/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23654&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8350148
  Stats: 104 lines in 2 files changed: 69 ins; 17 del; 18 mod
  Patch: https://git.openjdk.org/jdk/pull/23654.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23654/head:pull/23654

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


More information about the hotspot-runtime-dev mailing list