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

Adam Sotona asotona at openjdk.org
Wed Jan 14 18:15:23 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 incrementally with one additional commit since the last revision:

  removed debug prints

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

Changes:
  - all: https://git.openjdk.org/babylon/pull/829/files
  - new: https://git.openjdk.org/babylon/pull/829/files/a2d60642..ba727ee8

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=babylon&pr=829&range=02
 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=829&range=01-02

  Stats: 9 lines in 1 file changed: 2 ins; 7 del; 0 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