Skip to content

Commit a96116e

Browse files
committed
Some tweaks to for loop code-gen (though doesn't fix the issue).
1 parent 0450eaa commit a96116e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/QAST/Operations.nqp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,10 @@ QAST::Operations.add_core_op('for', :inlinable(1), -> $qastcomp, $op {
639639
$ops.push($listpost);
640640
$ops.push($blockpost);
641641

642+
# Get the iterator.
643+
$ops.push_pirop('set', $res, $listpost);
644+
$ops.push_pirop('iter', $iter, $listpost);
645+
642646
# Set up exception handler.
643647
my $handler := 1;
644648
my $exc_reg;
@@ -652,17 +656,12 @@ QAST::Operations.add_core_op('for', :inlinable(1), -> $qastcomp, $op {
652656
$ops.push_pirop('push_eh', $exc_reg);
653657
}
654658

655-
# Get the iterator.
656-
$ops.push_pirop('set', $res, $listpost);
657-
$ops.push_pirop('iter', $iter, $listpost);
658-
659659
# Loop while we still have values.
660660
my $lbl_next := PIRT::Label.new(:name('for_next'));
661661
my $lbl_redo := PIRT::Label.new(:name('for_redo'));
662662
my $lbl_done := PIRT::Label.new(:name('for_done'));
663663
$ops.push($lbl_next);
664664
$ops.push_pirop('unless', $iter, $lbl_done);
665-
$ops.push($lbl_redo);
666665

667666
# Fetch values.
668667
my @valreg;
@@ -675,6 +674,7 @@ QAST::Operations.add_core_op('for', :inlinable(1), -> $qastcomp, $op {
675674
}
676675

677676
# Emit call.
677+
$ops.push($lbl_redo);
678678
$ops.push_pirop('call', $blockpost, |@valreg, :result($res));
679679

680680
# Loop.

0 commit comments

Comments
 (0)