RFR: 8366488: JVM_FindClassFromClass should assert that from class is never null

Coleen Phillimore coleenp at openjdk.org
Mon Oct 27 13:48:50 UTC 2025


On Mon, 27 Oct 2025 13:44:34 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> Hi all,
>> 
>> The `from_class` nullcheck  in `JVM_FindClassFromClass` is redundant, as the this is the Java mirror which cannot be null during class linking/verification [1]. Therefore, it has been refactored to be an assertion instead.
>> 
>> Testing: tiers 1-4 Linux (x64, AArch64), macOS (x64, AArch64), Windows (x64). As part of a separate experiment, I've also run tiers 1-6 on x64 Linux with a non-null assertion before we call `Verifier::inference_verify` (which in turn, eventually, calls this code).
>> 
>> [1] For reasoning, see https://bugs.openjdk.org/browse/JDK-8366488
>
> src/hotspot/share/prims/jvm.cpp line 830:
> 
>> 828:   Klass* from_class = (from_class_oop == nullptr)
>> 829:                            ? (Klass*)nullptr
>> 830:                            : java_lang_Class::as_Klass(from_class_oop);
> 
> Don't you want to get rid of this ?: also?  Assert that from_class_oop != nullptr instead?

Or have both asserts, from_class_oop is non-null and also from_class_oop->_klass is non-null.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27957#discussion_r2465744512


More information about the hotspot-dev mailing list