[External] : Re: Stack size miscalculated with try-catch blocks

Adam Sotona adam.sotona at oracle.com
Fri Nov 1 13:16:13 UTC 2024




You are right, it is a recent regression and the JDK I tested it on was outdated, my apologies.

The regression is here:
https://github.com/openjdk/jdk/blob/f77a5144a12fc31bad8b672a3cc9caa688d78e72/src/java.base/share/classes/jdk/internal/classfile/impl/StackMapGenerator.java#L1117
introduced by https://github.com/openjdk/jdk/pull/20756

I’ve created a bug https://bugs.openjdk.org/browse/JDK-8343436 and working on the fix.

Thanks for the report,
Adam


From: Rafael Winterhalter <rafael.wth at gmail.com>
Date: Wednesday, 30 October 2024 at 11:41
To: Adam Sotona <adam.sotona at oracle.com>
Cc: classfile-api-dev <classfile-api-dev at openjdk.org>
Subject: [External] : Re: Stack size miscalculated with try-catch blocks
Is this pushed to master? I still experience these errors on multiple test cases.

Am Mi., 30. Okt. 2024 um 10:19 Uhr schrieb Adam Sotona <adam.sotona at oracle.com<mailto:adam.sotona at oracle.com>>:
Hi Rafael,
Please update to the latest codebase, maxstack of the provided test case is correctly calculated now.

Thanks,
Adam


From: classfile-api-dev <classfile-api-dev-retn at openjdk.org<mailto:classfile-api-dev-retn at openjdk.org>> on behalf of Rafael Winterhalter <rafael.wth at gmail.com<mailto:rafael.wth at gmail.com>>
Date: Thursday, 24 October 2024 at 8:33
To: classfile-api-dev <classfile-api-dev at openjdk.org<mailto:classfile-api-dev at openjdk.org>>
Subject: Stack size miscalculated with try-catch blocks
Hello,

when testing a recent build of the JDK with my bridge to ASM, I encountered some test failures. This is related to the stack size of a method being calculated with an additional, unnecessary slot. This can be reproduced using https://github.com/raphw/asm-jdk-bridge<https://urldefense.com/v3/__https:/github.com/raphw/asm-jdk-bridge__;!!ACWV5N9M2RV99hQ!Jc9CG0Gsp57pUC2shOI0ROdVXcjc33MSPr_6s-ugdwRI-ninSwYcWmlXc3TwkuBlJeZIGgwHvHBoYue6PZBm$>

This can also be reproduced by inspecting the computed stack for:

void c() {
    try {
        throw new RuntimeException();
    } catch (RuntimeException e) {
    }
}
which will be computed as 3 and not 2.

Best regards, Rafael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20241101/9e9b57b9/attachment-0001.htm>


More information about the classfile-api-dev mailing list