Try/catch/finally builder
Paul Sandoz
paul.sandoz at oracle.com
Tue Aug 23 22:39:44 UTC 2022
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.
More information about the classfile-api-dev
mailing list