On Tue, 25 Nov 2025 01:01:17 GMT, Dean Long <[email protected]> wrote:

>> src/hotspot/share/opto/library_call.cpp line 4100:
>> 
>>> 4098:     // Other types can report the actual _super.
>>> 4099:     // (To verify this code sequence, check the asserts in 
>>> JVM_IsInterface.)
>>> 4100:     if (generate_interface_guard(kls, region) != nullptr)
>> 
>> BTW why did you decide to change the order of the checks?
>
> I noticed that too.  It is necessary for correctness now.  It is incorrect 
> and unsafe to use generate_interface_guard() on array after this change, 
> because an array klass is not an InstanceKlass.

Oh, that's subtle... It deserves a comment at least.

We could also change `LibraryCallKit::generate_interface_guard()` to require 
`kls` to be of type `TypeInstKlassPtr`, but then we would need a cast before 
calling it from `LibraryCallKit::inline_native_Class_query()`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28371#discussion_r2558217038

Reply via email to