RFR: 8369238: Allow virtual thread preemption on some common class initialization paths [v2]

Patricio Chilano Mateo pchilanomate at openjdk.org
Thu Oct 16 16:26:09 UTC 2025


On Thu, 16 Oct 2025 09:05:24 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> Patricio Chilano Mateo has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains four commits:
>> 
>>  - Merge branch 'master' into JDK-8369238
>>  - RISC-V support
>>  - Fix whitespaces
>>  - v1
>
> src/hotspot/cpu/aarch64/continuationFreezeThaw_aarch64.inline.hpp line 209:
> 
>> 207:     // the last_sp saved in the frame (remove possible alignment added while
>> 208:     // thawing, see ThawBase::finish_thaw()). We also need to clear the last_sp
>> 209:     // saved in the frame as it is not expected to be set in case we preempt again.
> 
> A bit stronger?
> Suggestion:
> 
>     // saved in the frame because it must be clear if we freeze again.

Just to add more context, not clearing last_sp will make this assert [1] fire if we freeze again. That assert is mostly a verification check, because we know the interpreter doesn’t set last_sp for the top frame when calling into the VM. But I don’t see a fundamental reason why it must be cleared (removing the assert and not clearing last_sp works). I don’t see any other code that checks last_sp needs to be cleared for the top frame (other than in the interpreter before calling into the VM).
How about changing that last sentence with: `We also clear last_sp to match the behavior when calling the VM from the interpreter (we check for this in FreezeBase::prepare_freeze_interpreted_top_frame).`

[1] https://github.com/openjdk/jdk/blob/87092ef1d97e00ddb6674b0e309f2f904d307604/src/hotspot/cpu/aarch64/continuationFreezeThaw_aarch64.inline.hpp#L136

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27802#discussion_r2436641958


More information about the core-libs-dev mailing list