On Fri, 22 May 2026 09:47:16 GMT, Serguei Spitsyn <[email protected]> wrote:

>> This change fixes a long standing performance issue related to the debugger 
>> single stepping that is using JVMTI `FramePop` events as a part of step over 
>> handling. The performance issue is that the target thread continues its 
>> execution in very slow `interp-only` mode in a context of frame marked for 
>> `FramePop` notification with the JVMTI `NotifyFramePop`. It includes other 
>> method calls recursively upon a return from the frame.
>> 
>> This fix is to avoid enforcing the `interp-only` execution mode for threads 
>> when `FramePop` events are enabled with the JVMTI 
>> `SetEventNotificationMode()`. Instead, the target frame has been deoptimized 
>> and kept interpreted by disabling `OSR` optimization by the function 
>> `InterpreterRuntime::frequency_counter_overflow_inner()`. (Big thanks to 
>> @fisk for this suggestion!) Additionally, some tweaks are applied in several 
>> places where the `java_thread->is_interp_only_mode()` is checked.
>> The other details will be provided in the first PR request comment.
>> 
>> Testing:
>>  - test `serviceability/jvmti/vthread/ThreadStateTest` was updated to 
>> provide some extra test coverage
>>  - submitted mach5 tiers 1-6
>> 
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Serguei Spitsyn has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   review: 1. Add asserts, rem comment 2. Remove can_generate_frame_pop_events 
> from can_generate_interpreter_events

The JVMTI source code and test changes look good. 
There are few small questions/checks.
I haven't reviewed changes in frame.cpp.

src/hotspot/share/interpreter/interpreterRuntime.cpp line 1077:

> 1075:   assert(last_frame.is_interpreted_frame(), "must come from 
> interpreter");
> 1076: 
> 1077:   if (JvmtiExport::can_post_frame_pop() && 
> JvmtiExport::has_frame_pop_for_top_frame(current)) {

Shouldn't be this guarded by 'INCLUDE_JVMTI' or something similar?

src/hotspot/share/prims/jvmtiImpl.hpp line 41:

> 39: // Forward Declaration
> 40: 
> 41: class JvmtiEnv;

Just to double check, if it still needed?

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

Marked as reviewed by lmesnik (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/28407#pullrequestreview-4365818495
PR Review Comment: https://git.openjdk.org/jdk/pull/28407#discussion_r3305483151
PR Review Comment: https://git.openjdk.org/jdk/pull/28407#discussion_r3305680319

Reply via email to