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

Vladimir Ivanov vlivanov at openjdk.org
Fri Jun 13 04:48:28 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!

Looks good.

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

Marked as reviewed by vlivanov (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/25766#pullrequestreview-2923402355


More information about the hotspot-runtime-dev mailing list