On Fri, 5 Jun 2026 19:31:59 GMT, Coleen Phillimore <[email protected]> wrote:

>> This change refactors the super class scalar argument checking code and 
>> deoptimization so that it is only called at link time and not for 
>> frame::describe() and other places that are only retrieving the calling 
>> convention.  The only time that we detect a mismatch is during class 
>> linking, before the overriding subclass method can run.
>> 
>> This avoids running vm code while thread_in_Java, which is unsafe, and 
>> removes the ThreadInVMfromUnknown, which was even more unsafe.
>> 
>> Tested with tier1-4.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Coleen Phillimore has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Move some asserts around.

Thanks for fixing this. The refactoring also makes the code much more readable.

src/hotspot/share/runtime/sharedRuntime.cpp line 2904:

> 2902:   assert(JavaThread::current()->thread_state() != _thread_in_native, 
> "must not be in native");
> 2903:   bool has_scalarized = false;
> 2904:   if (_method != nullptr) {

Given that the non-link case relies on the method being linked already to 
compute the signatures, should we assert that the adapter is available?

`assert(link_time || _method->adapter() != nullptr, "invariant");`

src/hotspot/share/runtime/sharedRuntime.cpp line 2951:

> 2949:           SigEntry::add_entry(_sig_cc_ro, T_OBJECT, ss.as_symbol());
> 2950:         }
> 2951:         bt = T_OBJECT;

Preexistent: this can be removed since it’s one of the branch conditions.

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

Marked as reviewed by pchilanomate (no project role).

PR Review: 
https://git.openjdk.org/valhalla/pull/2517#pullrequestreview-4439064691
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2517#discussion_r3364920605
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2517#discussion_r3364930430

Reply via email to