Skip to content

Commit

Permalink
[jvm] Fix bug in frugal quant
Browse files Browse the repository at this point in the history
Similiar fix as in 854baa6 for the js backend, pmurias++.

Fixes RT #125021 and GH#1248 for Rakudo.
  • Loading branch information
usev6 committed Nov 15, 2017
1 parent 7578d32 commit 0bea688
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/vm/jvm/QAST/Compiler.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -6030,7 +6030,8 @@ class QAST::CompilerJAST {
elsif $backtrack eq 'f' {
my $seplabel := JAST::Label.new( :name($prefix ~ '_sep') );
my $mark := &*REGISTER_MARK($looplabel);

my $tmp_rep := $*TA.fresh_i();

$il.append($IVAL_ZERO);
$il.append(JAST::Instruction.new( :op('lstore'), %*REG<rep> ));
if $min < 1 {
Expand All @@ -6039,14 +6040,18 @@ class QAST::CompilerJAST {
JAST::Instruction.new( :op('lload'), %*REG<rep> ));
$il.append(JAST::Instruction.new( :op('goto'), $donelabel ));
}
$il.append(JAST::Instruction.new( :op('goto'), $seplabel )) if $sep;
if $sep {
$il.append($IVAL_ZERO);
$il.append(JAST::Instruction.new( :op('lstore'), $tmp_rep ));
$il.append(JAST::Instruction.new( :op('goto'), $seplabel ));
}
$il.append($looplabel);
$il.append(JAST::Instruction.new( :op('lload'), %*REG<rep> ));
$il.append(JAST::Instruction.new( :op('lstore'), %*REG<itemp> ));
$il.append(JAST::Instruction.new( :op('lstore'), $tmp_rep ));
$il.append(self.regex_jast($sep)) if $sep;
$il.append($seplabel) if $sep;
$il.append(self.regex_jast($node[0]));
$il.append(JAST::Instruction.new( :op('lload'), %*REG<itemp> ));
$il.append(JAST::Instruction.new( :op('lload'), $tmp_rep ));
$il.append($IVAL_ONE);
$il.append($LADD);
$il.append(JAST::Instruction.new( :op('lstore'), %*REG<rep> ));
Expand Down

0 comments on commit 0bea688

Please sign in to comment.