RFR: 8369238: Allow virtual thread preemption on some common class initialization paths [v2]
Patricio Chilano Mateo
pchilanomate at openjdk.org
Mon Oct 27 19:44:55 UTC 2025
On Sat, 25 Oct 2025 02:40:03 GMT, Dean Long <dlong at openjdk.org> wrote:
>> 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
>
> FWIW, interpreter_frame_tos_address() behaves differently depending on if last_sp() is cleared or not. I know deoptimization sets last_sp temporarily but makes sure to clear it before giving control back to the interpreter.
Right, but if `interpreter_frame_last_sp()` is the same as `sp()` then `interpreter_frame_tos_address()` will return the same value. My guess is that since we are already setting `_last_Java_sp` when making VM calls, there is no point in the extra bookkeeping of setting and clearing `interpreter_frame_last_sp` so we leave it as nullptr.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27802#discussion_r2466872228
More information about the hotspot-dev
mailing list