On Wed, 8 Apr 2026 05:04:03 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) remove unneeded assert, (2) simplify one statement in 
> JvmtiEnvBase::set_frame_pop

Changes requested by lmesnik (Reviewer).

src/hotspot/share/prims/jvmtiEnvBase.cpp line 2506:

> 2504:   }
> 2505:   if (!_set) { // ClearAllFramePops
> 2506:     _state->clear_vthread_pending_deopts();

The state is cleared always, even there are some other jvmti environments still 
set FramePops. They are going to miss the events.

Seems the clear_vthread_pending_deopts() should be called based on the status 
of FramePop for all environments.

test/jdk/com/sun/jdi/StepOverStressTest.java line 33:

> 31:  * @run build TestScaffold VMConnection TargetListener TargetAdapter
> 32:  * @run compile -g StepOverStressTest.java
> 33:  * @run driver/timeout=6000 StepOverStressTest

Seems that test is very slow.  Please check that it is not going to be executed 
in tier1.

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

PR Review: https://git.openjdk.org/jdk/pull/28407#pullrequestreview-4172827175
PR Review Comment: https://git.openjdk.org/jdk/pull/28407#discussion_r3139848236
PR Review Comment: https://git.openjdk.org/jdk/pull/28407#discussion_r3139782923

Reply via email to