RFR: 8285447: StackWalker minimal batch size should be optimized for getCallerClass [v4]

Brent Christian bchristi at openjdk.org
Tue Sep 12 21:08:53 UTC 2023


On Mon, 11 Sep 2023 17:52:56 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> Typically it will find the caller class at the second stack frame from the frame of executing `StackWalker::getCallerClass`.   The initial size of the buffer can be changed from 8 to 4 (the top 2 elements are reserved for implementation use).   If it fetches another batch, `getCallerClass` may be invoked via core reflection, so subsequent batches can be increased to a larger size.   This PR also moves the benchmark for `getCallerClass` in its own file because it does not need to test with different depth and can be separated from StackWalkBench.
>
> Mandy Chung has updated the pull request incrementally with one additional commit since the last revision:
> 
>   cleanup

test/micro/org/openjdk/bench/java/lang/CallerClassBench.java line 45:

> 43: public class CallerClassBench {
> 44:     static final StackWalker INST = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
> 45: 

Could `DROP_METHOD_INFO` also be used here?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15642#discussion_r1323574924


More information about the core-libs-dev mailing list