Integrated: 8355556: JVM crash because archived method handle intrinsics are not restored

Ioi Lam iklam at openjdk.org
Fri Jun 13 16:15:00 UTC 2025


On Thu, 12 Jun 2025 02:48:44 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> `AOTLinkedClassBulkLoader::finish_loading_javabase_classes()` can execute Java bytecodes (from `<clinit>`). If one of these bytecodes is an AOT-resolved `invokedynamic`, it may be dispatched using an archived method handle intrinsic. Therefore, we should call `SystemDictionary::restore_archived_method_handle_intrinsics()` first to make sure that the method handle intrinsics are ready to be used.
> 
> In the JDK mainline, we only execute a very limited set of Java methods which happens to not include any `invokedynamic` bytecodes. That's why this bug has not been found in the mainline.
> 
> However, in the Leyden repo, we have other optimizations, such as archived ProtectionDomains, which will cause `invokedynamic` bytecodes to be executed inside `AOTLinkedClassBulkLoader::finish_loading_javabase_classes()`.
> 
> Since this is a potential issue even for the JDK mainline, we should fix it (and also backport to JDK 25).
> 
> Thanks to @iwanowww for providing the fix!

This pull request has now been integrated.

Changeset: 366650a4
Author:    Ioi Lam <iklam at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/366650a438d046f3da5b490c42e37faaf3a9abc5
Stats:     2 lines in 1 file changed: 1 ins; 1 del; 0 mod

8355556: JVM crash because archived method handle intrinsics are not restored

Reviewed-by: adinn, vlivanov, shade

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

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


More information about the hotspot-runtime-dev mailing list