RFR: 8316456: StackWalker may skip Continuation::yield0 frame mistakenly [v2]
Patricio Chilano Mateo
pchilanomate at openjdk.org
Thu Sep 21 19:34:23 UTC 2023
On Thu, 21 Sep 2023 18:20:36 GMT, Mandy Chung <mchung at openjdk.org> wrote:
>> `JVM_MoreStackWalk` has a bug that always assumes that the Java frame
>> stream is currently at the frame decoded in the last patch and so always
>> advances to the next frame before filling in the new batch of stack frame.
>> However `JVM_MoreStackWalk` may return 0. The library will set
>> the continuation to its parent. It then call `JVM_MoreStackWalk` to continue
>> the stack walking but the last decoded frame has already been advanced.
>> The Java frame stream is already at the top frame of the parent continuation. .
>> The current implementation skips "Continuation::yield0" mistakenly. This
>> only happens with `-XX:+ShowHiddenFrames` or `StackWalker.Option.SHOW_HIDDEN_FRAMES`.
>>
>> The fix is to pass the number of frames decoded in the last batch to `JVM_MoreStackWalk`
>> so that the VM will determine if the current frame should be skipped or not.
>>
>> `test/jdk/jdk/internal/vm/Continuation/Scoped.java` test now correctly checks
>> the expected result where "yield0" exists between "enter" and "run" frames.
>
> Mandy Chung has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>
> - Merge branch 'master' of https://github.com/openjdk/jdk into JDK-8316456
> - call setBatch to update origin and fence for an empty batch
> - 8316456: StackWalker may skip Continuation::yield0 frame mistakenly
Looks good to me, thanks.
Patricio
src/hotspot/share/prims/stackwalk.cpp line 189:
> 187: // skip hidden frames for default StackWalker option (i.e. SHOW_HIDDEN_FRAMES
> 188: // not set) and when StackWalker::getCallerClass is called
> 189: LogTarget(Debug, stackwalk) lt;
Nit, leftover.
-------------
Marked as reviewed by pchilanomate (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/15804#pullrequestreview-1638561745
PR Review Comment: https://git.openjdk.org/jdk/pull/15804#discussion_r1333514103
More information about the core-libs-dev
mailing list