RFR: 8362306: HotSpotJVMCIRuntime.getMirror can crash [v3]

Gilles Duboscq gdub at openjdk.org
Wed Jul 16 14:42:49 UTC 2025


On Wed, 16 Jul 2025 13:17:04 GMT, Doug Simon <dnsimon at openjdk.org> wrote:

>> This PR fixes `HotSpotJVMCIRuntime.getMirror(ResolvedJavaMethod method)` and `HotSpotJVMCIRuntime.getMirror(ResolvedJavaField field)` so that they return null for `<clinit>` and an injected field respectively instead of crashing.
>
> Doug Simon has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - fixed bug in use of JVMCI traps
>  - moved inject field check into check_field for benefit of get_encoded_annotation_data

src/hotspot/share/jvmci/jvmciCompilerToVM.cpp line 3084:

> 3082:   CompilerThreadCanCallJava canCallJava(thread, true); // Requires Java support
> 3083:   InstanceKlass* holder = InstanceKlass::cast(UNPACK_PAIR(Klass, klass));
> 3084:   return get_encoded_annotation_data(holder, holder->class_annotations(), true, filter_length, filter_klass_pointers, THREAD, JVMCI_CHECK_NULL);

Can `JVMCI_CHECK_` be used in `return` statements? i think the "check and return default value" part would be unreachable.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26346#discussion_r2210628575


More information about the graal-dev mailing list