RFR: 8361730: The CodeBuilder.trying(BlockCodeBuilder,CatchBuilder) method generates corrupted bytecode in certain cases

ExE Boss duke at openjdk.org
Sun Aug 3 18:20:00 UTC 2025


On Fri, 1 Aug 2025 18:05:54 GMT, Chen Liang <liach at openjdk.org> wrote:

> Explicitly document that BlockCodeBuilder expects control flow to continue after it merges back to the parent block, so failure to do that by the users can lead to malformed code. This is better than introducing complex and costly analysis.

I think that the `trying` builder could be improved to only insert the `goto branchLabel` when the last instruction or pseudo‑instruction isn’t a `ReturnInstruction`, a `ThrowInstruction`, or a `BranchInstruction`.

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

PR Comment: https://git.openjdk.org/jdk/pull/26602#issuecomment-3148612587


More information about the core-libs-dev mailing list