This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Consolidate adjacent padrange ops
authorDavid Mitchell <davem@iabyn.com>
Fri, 2 Nov 2012 14:37:29 +0000 (14:37 +0000)
committerDavid Mitchell <davem@iabyn.com>
Sat, 10 Nov 2012 13:39:33 +0000 (13:39 +0000)
commit4774ee0a8f9bc16a2ee4d1603401c927d02c41bc
treead7a99dc1415fd9cd536d4612c591c7fd0b0a44e
parentd5524600caf9e8c470e731c4f5a924868154645a
Consolidate adjacent padrange ops

In something like

    my ($a,$b);
    my ($c,$d);

when converting $c,$d into a padrange op, check first whether we're
immediately preceded by a similar padrange (and nextstate) op,
and if so re-use the existing padrange op (by increasing the count).
Also, skip the first nextstate and only use the second nextstate.

So

    pushmark;
    padsv[$a]; padsv[$b]; list;
    nextstate 1;
    pushmark;
    padsv[$c]; padsv[$c]; list;
    nextstate 2;

becomes

    padrange[$a,$b]
    nextstate 1;
    pushmark;
    padsv[$c]; padsv[$c]; list;
    nextstate 2;

which then becomes

    padrange[$a,$b,$c,$d];
    nextstate 2;
ext/B/t/optree_misc.t
op.c