RFR: 8268829: Provide an optimized way to walk the stack with Class object only [v9]

Mandy Chung mchung at openjdk.org
Wed Sep 6 16:56:50 UTC 2023


On Thu, 31 Aug 2023 23:17:02 GMT, Brent Christian <bchristi at openjdk.org> wrote:

>> Mandy Chung has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 29 commits:
>> 
>>  - Merge
>>  - Remove the new getInstance method taking varargs
>>  - update mode to be int rather than long
>>  - update tests
>>  - Review feedback on javadoc
>>  - Revised the API change.  Add Option::DROP_METHOD_INFO
>>  - Review feedback from Remi
>>  - fixup javadoc
>>  - Review feedback: move JLIA to ClassFrameInfo
>>  - review feedback and javadoc clean up
>>  - ... and 19 more: https://git.openjdk.org/jdk/compare/c8acab1d...111661bc
>
> src/java.base/share/classes/java/lang/StackStreamFactory.java line 657:
> 
>> 655:     static final class ClassFrameBuffer extends FrameBuffer<ClassFrameInfo> {
>> 656:         final StackWalker walker;
>> 657:         ClassFrameInfo[] classFrames;      // caller class for fast path
> 
> Maybe I missed it, but I don't see any differences between `ClassFramesBuffer` and `StackFrameBuffer` other than the `ClassFrameInfo`/`StackFrameInfo` types. Could a single, generified Buffer class serve for both?

Good observation.  There is some performance difference when the buffer is created via core reflection vs via bytecode invocation.  StackFrameTraverser and LiveStackFrameTraverser can use the generified version.  As `getCallerClass` is performance sensitive, need to keep `ClassFrameBuffer`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15370#discussion_r1317577196


More information about the core-libs-dev mailing list