Skip to content

Commit

Permalink
When converting Regex nodes in as_post, get PMC from cursor_start_all.
Browse files Browse the repository at this point in the history
This means we use a few more registers, but the new nqp::list only supports
fetching PMCs, so now it fetches PMCs from the list and then converts to int
or string by setting the appropriate kind of register.
  • Loading branch information
arnsholt committed Mar 23, 2013
1 parent 6892934 commit 95084d2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/QAST/Compiler.nqp
Expand Up @@ -1068,7 +1068,7 @@ class QAST::Compiler is HLL::Compiler {
my %*REG;

# build the list of (unique) registers we need
my $reglist := nqp::split(' ', 'start pmc tgt string pos int off int eos int rep int cur pmc curclass pmc bstack pmc cstack pmc');
my $reglist := nqp::split(' ', 'start pmc tgtp pmc tgt string posp pmc pos int off int eos int rep int cur pmc curclass pmc bstack pmc cstack pmc');
while $reglist {
my $reg := nqp::shift($reglist);
my $name := %*REG{$reg} := $prefix ~ $reg;
Expand All @@ -1088,11 +1088,14 @@ class QAST::Compiler is HLL::Compiler {
# common prologue
$ops.push_pirop('callmethod', '"!cursor_start_all"', 'self', :result(%*REG<start>));
$ops.push_pirop('set', %*REG<cur>, %*REG<start> ~ '[0]');
$ops.push_pirop('set', %*REG<tgt>, %*REG<start> ~ '[1]');
$ops.push_pirop('set', %*REG<pos>, %*REG<start> ~ '[2]');
$ops.push_pirop('set', %*REG<tgtp>, %*REG<start> ~ '[1]');
$ops.push_pirop('set', %*REG<tgt>, %*REG<tgtp>);
$ops.push_pirop('set', %*REG<posp>, %*REG<start> ~ '[2]');
$ops.push_pirop('set', %*REG<pos>, %*REG<posp>);
$ops.push_pirop('set', %*REG<curclass>, %*REG<start> ~ '[3]');
$ops.push_pirop('set', %*REG<bstack>, %*REG<start> ~ '[4]');
$ops.push_pirop('set', '$I19', %*REG<start> ~ '[5]');
$ops.push_pirop('set', '$P19', %*REG<start> ~ '[5]');
$ops.push_pirop('set', '$I19', '$P19');
$ops.push_pirop('store_lex', 'unicode:"$\x{a2}"', %*REG<cur>);
$ops.push_pirop('length', %*REG<eos>, %*REG<tgt>);
$ops.push_pirop('eq', '$I19', 1, $restartlabel);
Expand Down

0 comments on commit 95084d2

Please sign in to comment.