RFR: 8365192: post_meth_exit should be in vm state when calling get_jvmti_thread_state [v5]
Martin Doerr
mdoerr at openjdk.org
Mon Sep 8 15:40:17 UTC 2025
On Mon, 8 Sep 2025 15:36:45 GMT, Leonid Mesnik <lmesnik at openjdk.org> wrote:
>> This is the second attempt to fix method `post_meth_exit` to correctly set state and preserve result.
>> The related fix here:
>> https://github.com/openjdk/jdk/commit/b7b64bb6c800b45e32ff37b1b92b5927a3b3fb56
>> Hope fix became clarere now.
>>
>> There 2 problems in this post_meth_exit:
>> 1) The result is preserved only if `state->is_enabled(JVMTI_EVENT_METHOD_EXIT)` however transition in the JRT_BLOCK_END happens always. So there is a risk of loosing method results in the interp_only mode.
>> 2) The method `get_jvmti_thread_state` should be called when thread is in vm state only.
>>
>> The fix adds `post_method_exit_transition` to have single exit point with oop restoration.
>
> Leonid Mesnik has updated the pull request incrementally with one additional commit since the last revision:
>
> more changes reverted
src/hotspot/share/prims/jvmtiExport.cpp line 1844:
> 1842: BasicType type = current_frame.interpreter_frame_result(&oop_result, &value);
> 1843: assert(type == T_VOID || current_frame.interpreter_frame_expression_stack_size() > 0,
> 1844: "Stack shouldn't be empty");
I think this assertion needs an adaptation. The expression stack can be empty for native method calls. The result does not necessarily need to be on the expression stack depending on the platform.
Or what else is the reason it is expected to be non-empty?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27112#discussion_r2330625454
More information about the serviceability-dev
mailing list