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

Adam Sotona asotona at openjdk.org
Wed Jan 14 17:36:03 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 incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:

 - 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:
  - all: https://git.openjdk.org/babylon/pull/829/files
  - new: https://git.openjdk.org/babylon/pull/829/files/e281f1a7..a2d60642

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

  Stats: 3298 lines in 48 files changed: 1965 ins; 1040 del; 293 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