Try/catch/finally builder
Adam Sotona
adam.sotona at oracle.com
Wed Aug 24 08:50:58 UTC 2022
It looks good to me (I assume CodeBuilder::trying2 will replace CodeBuidler::trying)
Just one implementation comment:
For successful synchronous stack tracking it is critical to always declare exceptionCatch or exceptionCatchAll before the related handler block starts (before the handler Label mentioned in the exceptionCatch is resolved).
Thanks,
Adam
From: classfile-api-dev <classfile-api-dev-retn at openjdk.org> on behalf of Paul Sandoz <paul.sandoz at oracle.com>
Date: Wednesday, 24 August 2022 0:39
To: classfile-api-dev at openjdk.org <classfile-api-dev at openjdk.org>
Subject: Try/catch/finally builder
Hi,
Here’s a prototype of a try/catch/finally builder (that should replace the current approach):
https://github.com/openjdk/jdk-sandbox/compare/classfile-api-branch...PaulSandoz:jdk-sandbox:try-catch-finally-builder?expand=1
So far it all seems to work and produces correct code for nested building, generating similar code as the source compiler produces.
I need to do more thorough testing and commit unit tests.
—
One challenge is determining when a block exits. A branching instruction that exits the block should result in inlining of the finally code before the instruction, but it's hard to precisely determine if the branch target is within or outside of the block. At the moment I hard code to checking if the target is the break label of the block, otherwise it is assumed the branch does not exit the block. I don’t think this is generally decidable unless all block instructions are first buffered.
Paul.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20220824/bebfef78/attachment.htm>
More information about the classfile-api-dev
mailing list