[code-reflection] RFR: Improved NormalizeBlocksTransformer and its application in BytecodeGenerator. [v6]
Adam Sotona
asotona at openjdk.org
Thu Jan 15 17:59:11 UTC 2026
On Thu, 15 Jan 2026 08:25:32 GMT, Adam Sotona <asotona at openjdk.org> wrote:
>> Lowering of pattern matching in switch statements and expressions produces an inefficient tree of conditional branches. This PR does not improve the lowering itself; however, it reduces overhead in the generated bytecode.
>>
>> `NormalizeBlocksTransformer` is improved to handle redundant conditional branches. It skips intermediate conditional branches with constant boolean arguments and re-targets them directly to the true or false branch, based on the argument's constant value.
>>
>> The `BytecodeGenerator` prepends `NormalizeBlocksTransformer` to leverage the optimized models for bytecode generation.
>
> Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains eight commits:
>
> - Merge remote-tracking branch 'babylon/code-reflection' into skip-cbranch-transform
> - fixed javadoc
>
> - added test
>
> - removed debug prints
>
> - Merge of SKIP_CBRANCH_TRANSFORM with NormalizeBlocksTransformer
>
> - Merge remote-tracking branch 'babylon/code-reflection' into skip-cbranch-transform
> - removed debug print
>
> - Skip constant conditional branch transformation.
Thank you!
-------------
PR Comment: https://git.openjdk.org/babylon/pull/829#issuecomment-3756147930
More information about the babylon-dev
mailing list