We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent adcc379 commit 32cae38Copy full SHA for 32cae38
src/coreclr/jit/codegenwasm.cpp
@@ -570,8 +570,14 @@ void CodeGen::genTableBasedSwitch(GenTree* treeNode)
570
assert(caseCount > 0);
571
assert(desc->HasDefaultCase());
572
573
- GetEmitter()->emitIns_I(INS_br_table, EA_4BYTE, caseCount);
+ // br_table list (labelidx*) labelidx
574
+ // list is prefixed with length, which is caseCount - 1
575
+ //
576
+ GetEmitter()->emitIns_I(INS_br_table, EA_4BYTE, caseCount - 1);
577
578
+ // Emit the list case targets, then default case target
579
+ // (which is always the last case in the desc).
580
581
for (unsigned caseNum = 0; caseNum < caseCount; caseNum++)
582
{
583
BasicBlock* const caseTarget = desc->GetCase(caseNum)->getDestinationBlock();
0 commit comments