[code-reflection] RFR: Switch lowering fixes

Adam Sotona asotona at openjdk.org
Mon Jan 5 15:31:17 UTC 2026


On Mon, 5 Jan 2026 15:06:31 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:

>> This patch fixes `bytecode/impl/LoweringTransform` with unboxing selector, implicit default target leading to exit block and conversion of constant labels.
>> Unreflect runs of `TestSwitchExpressionOp` and `TestSwitchStatementOp` are now enabled and pass.
>
> src/jdk.incubator.code/share/classes/jdk/incubator/code/bytecode/impl/LoweringTransform.java line 108:
> 
>> 106: 
>> 107:         Value selector = block.context().getValue(swOp.operands().get(0));
>> 108:         if (ConstantLabelSwitchChecker.isIntegralReferenceType(selector.type())) {
> 
> Why we need  to unbox the selector ?

`ConstantLabelSwitchOp` represents `tableswitch` and `lookupswitch` bytecode instructions and they accept only primitive int and its sub-types.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/804#discussion_r2661892374


More information about the babylon-dev mailing list