RFR: 8368182: AOT cache creation fails with class defined by JNI
Ioi Lam
iklam at openjdk.org
Sun Sep 21 20:07:43 UTC 2025
The AOT cache should store only classes from known locations (modules file, classpath, module path). Classes defined by JNI should be excluded.
However, the `ik->set_shared_classpath_index(0)` call in classLoader.cpp had the incorrect side effect of allowing all classes defined by JNI to be stored in the AOT configuration file at the end of the training run. This causes failure when we use the AOT configuration file to create the AOT cache.
The fix is to set the `shared_classpath_index` of such classes to -1 so they are excluded.
Also, `LambdaFormInvokers::regenerate_holder_classes()` needs to be updated to specify a non-null code source, so that the regenerated holder classes are not excluded.
-------------
Commit messages:
- 8368182: AOT cache creation fails with class defined by JNI
Changes: https://git.openjdk.org/jdk/pull/27412/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27412&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8368182
Stats: 179 lines in 4 files changed: 174 ins; 3 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/27412.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/27412/head:pull/27412
PR: https://git.openjdk.org/jdk/pull/27412
More information about the hotspot-runtime-dev
mailing list