RFR: 8367949: JFR: MethodTrace double-counts methods that catch their own exceptions
Jean-Noël Rouvignac
duke at openjdk.org
Wed Dec 24 18:51:06 UTC 2025
On Sun, 21 Dec 2025 16:22:25 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:
> Could I have a review of a PR that changes how the instrumentation of the MethodTrace and MethodTiming events is implemented, so they handle exceptions in a better way?
>
> For constructors, the current implementation is still used in certain corner cases. A proper implementation would require data-flow analysis, but for all practical purposes this code should work fine.
>
> Testing: jdk/jdk/jfr
>
> Thanks
> Erik
src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/Instrumentation.java line 80:
> 78: byte[] generated = classFile.build(classModel.thisClass().asSymbol(), classBuilder -> {
> 79: for (var ce : classModel) {
> 80: if (modifyClassElement(classModel,classBuilder, ce)) {
Suggestion:
if (modifyClassElement(classModel, classBuilder, ce)) {
src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/Instrumentation.java line 111:
> 109: Modification m = tm.modification();
> 110: if (m.tracing() || m.timing()) {
> 111: return modifyMethod(classModel,classBuilder, mm, tm);
Suggestion:
return modifyMethod(classModel, classBuilder, mm, tm);
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28947#discussion_r2646154444
PR Review Comment: https://git.openjdk.org/jdk/pull/28947#discussion_r2646154577
More information about the hotspot-jfr-dev
mailing list