Skip to content

Commit 7417743

Browse files
committed
Simplify conditional variant lookup
We already know we'll need _o because we test the op's kind on entry to the branch, so just use those without lookup. No idea why they're reversed ("if" takes an "unless_o"), but that was the case before I touched this part of the codebase.
1 parent 71658ad commit 7417743

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/vm/moar/QAST/QASTOperationsMAST.nqp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -828,9 +828,9 @@ for <if unless with without> -> $op_name {
828828
}
829829

830830
push_op(@ins,
831-
($op_name eq 'if' || $op_name eq 'with'
832-
?? @Negated-condition-op-kinds[@comp_ops[0].result_kind]
833-
!! @Condition-op-kinds[ @comp_ops[0].result_kind]),
831+
# the conditional routines are reversed on purpose
832+
$op_name eq 'if' || $op_name eq 'with'
833+
?? 'unless_o' !! 'if_o',
834834
$decont_reg,
835835
($operands == 3 ?? $else_lbl !! $end_lbl)
836836
);
@@ -1124,9 +1124,8 @@ for ('', 'repeat_') -> $repness {
11241124
my $decont_reg := $regalloc.fresh_register($MVM_reg_obj);
11251125
push_op(@loop_il, 'decont', $decont_reg, @comp_ops[0].result_reg);
11261126
push_op(@loop_il,
1127-
$op_name eq 'while'
1128-
?? @Negated-condition-op-kinds[@comp_ops[0].result_kind]
1129-
!! @Condition-op-kinds[ @comp_ops[0].result_kind],
1127+
# the conditional routines are reversed on purpose
1128+
$op_name eq 'while' ?? 'unless_o' !! 'if_o',
11301129
$decont_reg,
11311130
$done_lbl
11321131
);

0 commit comments

Comments
 (0)