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

Doug Simon dnsimon at openjdk.org
Wed Jul 16 15:03:39 UTC 2025


On Wed, 16 Jul 2025 14:38:35 GMT, Gilles Duboscq <gdub at openjdk.org> wrote:

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

Indeed - I've been bitten by this before! In this case, it's harmless given that the return statement is anyway the last statement in the method. Still, I'll revert my "fix".
I'm also wondering (again?) why the C++ compiler does not warning about unreachable code.

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

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


More information about the graal-dev mailing list