Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
use index_s even with ignorecase when scanning for literals
  • Loading branch information
timo committed Aug 9, 2016
1 parent 04c4ae3 commit 778d1a1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/vm/moar/QAST/QASTRegexCompilerMAST.nqp
Expand Up @@ -992,13 +992,24 @@ class QAST::MASTRegexCompiler {
$looplabel,
op('inc_i', %!reg<pos>),
];
if $node.list && $node.subtype ne 'ignorecase' && $node.subtype ne 'ignoremark' && $node.subtype ne 'ignorecase+ignoremark' {
if $node.list && $node.subtype ne 'ignoremark' && $node.subtype ne 'ignorecase+ignoremark' {
my $lit := $!regalloc.fresh_s();
nqp::push(@ins, op('const_s', $lit, sval($node[0])));
nqp::push(@ins, op('index_s', %!reg<pos>, %!reg<tgt>, $lit, %!reg<pos>));
nqp::push(@ins, op('eq_i', $ireg0, %!reg<pos>, %!reg<negone>));
$!regalloc.release_register($lit, $MVM_reg_str);
}
elsif $node.list && $node.subtype eq 'ignorecase' {
my $lit := $!regalloc.fresh_s();
nqp::push(@ins, op('const_s', $lit, sval(nqp::lc($node[0]))));
unless nqp::existskey(%!reg, 'haystacklc') {
%!reg<haystacklc> := $!regalloc.fresh_s();
nqp::push(@ins, op('lc', %!reg<haystacklc>, %!reg<tgt>));
}
nqp::push(@ins, op('index_s', %!reg<pos>, %!reg<haystacklc>, $lit, %!reg<pos>));
nqp::push(@ins, op('eq_i', $ireg0, %!reg<pos>, %!reg<negone>));
$!regalloc.release_register($lit, $MVM_reg_str);
}
else {
nqp::push(@ins, op('gt_i', $ireg0, %!reg<pos>, %!reg<eos>));
}
Expand Down

0 comments on commit 778d1a1

Please sign in to comment.