RFR: 8295537: Debug tracing for resolved java.lang.invoke.CallSite [v2]

Jorn Vernee jvernee at openjdk.org
Tue Oct 25 19:13:54 UTC 2022


On Tue, 25 Oct 2022 18:54:19 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   @JornVernee comments
>
> src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java line 329:
> 
>> 327:                 return null;
>> 328:             }
>> 329:         });
> 
> Not sure about this condition. It seems like `callerInfo[0] == callerName` will always be true at first, and then it gets overwritten by the stack trace element toString, so in effect it only picks up the first non-MethodHandleNatives caller? I think it could be clearer to use `filter` + `findFirst` to get the caller's `StackFrame` (that has the additional benefit of short-circuiting), and then convert to a String from there.
> 
> Also, please move the code that gets the caller info out-of-line to a helper method, since it's quite wordy.

Alternatively, maybe you could just dump the whole stack trace here (e.g. with Thread.dumpStack()), since it might be useful to see which code path triggers resolution of a call site as well. That would also include the line number of the caller.

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

PR: https://git.openjdk.org/jdk/pull/10842


More information about the core-libs-dev mailing list