RFR: 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 09:25:50 GMT, Andrew Dinn <adinn 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.

Thanks @adinn @iwanowww @shipilev for the review

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

PR Comment: https://git.openjdk.org/jdk/pull/25766#issuecomment-2970861716


More information about the hotspot-runtime-dev mailing list