[code-reflection] RFR: Skip constant conditional branch transformation.

Adam Sotona asotona at openjdk.org
Mon Jan 12 12:14:11 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. 
The `BytecodeGenerator` prepends `SKIP_CBRANCH_TRANSFORM`, a proprietary transformation focused on 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.

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

Commit messages:
 - 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=00
  Stats: 27 lines in 1 file changed: 26 ins; 0 del; 1 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