Integrated: 8368182: AOT cache creation fails with class defined by JNI

Ioi Lam iklam at openjdk.org
Wed Sep 24 20:55:32 UTC 2025


On Sun, 21 Sep 2025 20:00:09 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: 8f87fdce
Author:    Ioi Lam <iklam at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/8f87fdce0b17f3edd453054461895330b82e8a71
Stats:     179 lines in 4 files changed: 174 ins; 3 del; 2 mod

8368182: AOT cache creation fails with class defined by JNI

Reviewed-by: dholmes, matsaave

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

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


More information about the hotspot-runtime-dev mailing list