Skip to content

Commit

Permalink
Simplify conditional variant lookup
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zoffixznet committed Jan 22, 2018
1 parent 71658ad commit 7417743
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/vm/moar/QAST/QASTOperationsMAST.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -828,9 +828,9 @@ for <if unless with without> -> $op_name {
}

push_op(@ins,
($op_name eq 'if' || $op_name eq 'with'
?? @Negated-condition-op-kinds[@comp_ops[0].result_kind]
!! @Condition-op-kinds[ @comp_ops[0].result_kind]),
# the conditional routines are reversed on purpose
$op_name eq 'if' || $op_name eq 'with'
?? 'unless_o' !! 'if_o',
$decont_reg,
($operands == 3 ?? $else_lbl !! $end_lbl)
);
Expand Down Expand Up @@ -1124,9 +1124,8 @@ for ('', 'repeat_') -> $repness {
my $decont_reg := $regalloc.fresh_register($MVM_reg_obj);
push_op(@loop_il, 'decont', $decont_reg, @comp_ops[0].result_reg);
push_op(@loop_il,
$op_name eq 'while'
?? @Negated-condition-op-kinds[@comp_ops[0].result_kind]
!! @Condition-op-kinds[ @comp_ops[0].result_kind],
# the conditional routines are reversed on purpose
$op_name eq 'while' ?? 'unless_o' !! 'if_o',
$decont_reg,
$done_lbl
);
Expand Down

0 comments on commit 7417743

Please sign in to comment.