Skip to content

Commit

Permalink
teach parrot and jvm about zerowidth literals
Browse files Browse the repository at this point in the history
  • Loading branch information
timo committed Nov 20, 2013
1 parent c293015 commit 51192c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/vm/jvm/QAST/Compiler.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -4951,10 +4951,12 @@ class QAST::CompilerJAST {
$TYPE_STR, 'regionMatches', 'Z', 'Z', 'Integer', $TYPE_STR, 'Integer', 'Integer' ));
$il.append(JAST::Instruction.new( :op($node.negate ?? 'ifne' !! 'ifeq'), %*REG<fail> ));

$il.append(JAST::Instruction.new( :op('lload'), %*REG<pos> ));
$il.append(JAST::PushIVal.new( :value($litlen) ));
$il.append($LADD);
$il.append(JAST::Instruction.new( :op('lstore'), %*REG<pos> ));
unless $node.subtype eq 'zerowidth' {
$il.append(JAST::Instruction.new( :op('lload'), %*REG<pos> ));
$il.append(JAST::PushIVal.new( :value($litlen) ));
$il.append($LADD);
$il.append(JAST::Instruction.new( :op('lstore'), %*REG<pos> ));
}

$il;
}
Expand Down
2 changes: 1 addition & 1 deletion src/vm/parrot/QAST/Compiler.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ class QAST::Compiler is HLL::Compiler {
$ops.push_pirop('nqp_string_equal_at', '$I12', %*REG<tgt>, $litpost, %*REG<pos>);
$ops.push_pirop($cmpop, '$I12', 1, %*REG<fail>);
}
$ops.push_pirop('set', %*REG<pos>, '$I11');
$ops.push_pirop('set', %*REG<pos>, '$I11') unless $node.subtype eq 'zerowidth';
$ops;
}

Expand Down

0 comments on commit 51192c4

Please sign in to comment.