[code-reflection] RFR: Improved NormalizeBlocksTransformer and its application in BytecodeGenerator. [v7]

Adam Sotona asotona at openjdk.org
Thu Jan 15 17:58:58 UTC 2026


> 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 nine commits:

 - Merge remote-tracking branch 'babylon/code-reflection' into skip-cbranch-transform
   
 - 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.

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

Changes: https://git.openjdk.org/babylon/pull/829/files
  Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=829&range=06
  Stats: 202 lines in 3 files changed: 183 ins; 1 del; 18 mod
  Patch: https://git.openjdk.org/babylon/pull/829.diff
  Fetch: git fetch https://git.openjdk.org/babylon.git pull/829/head:pull/829

PR: https://git.openjdk.org/babylon/pull/829


More information about the babylon-dev mailing list