In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/01762542fcff2d3eb5e0fd287f28e872a0cfd5a4?hp=28482d6cad995d14acdad04e18ee2d4ee32c6a18>
- Log ----------------------------------------------------------------- commit 01762542fcff2d3eb5e0fd287f28e872a0cfd5a4 Author: Father Chrysostomos <[email protected]> Date: Sat Oct 18 10:23:26 2014 -0700 Use srefgen for anoncode srefgen is faster than refgen, since it doesnât have to loop through the arguments (there is only one) and there is no pushmark to execute. OA_RETSCALAR causes scalar context to be applied to anoncode ops, but it always returns one item anyway, so that causes no problems. ----------------------------------------------------------------------- Summary of changes: lib/B/Deparse.pm | 9 +++++---- op.c | 3 +-- opcode.h | 2 +- regen/opcodes | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/B/Deparse.pm b/lib/B/Deparse.pm index ddf2952..3866f32 100644 --- a/lib/B/Deparse.pm +++ b/lib/B/Deparse.pm @@ -2303,10 +2303,11 @@ sub pp_refgen { my($op, $cx) = @_; my $kid = $op->first; if ($kid->name eq "null") { - $kid = $kid->first; - if (!null($kid->sibling) and - $kid->sibling->name eq "anoncode") { - return $self->e_anoncode({ code => $self->padval($kid->sibling->targ) }); + my $anoncode = $kid = $kid->first; + if ($anoncode->name eq "anoncode" + or !null($anoncode = $kid->sibling) and + $anoncode->name eq "anoncode") { + return $self->e_anoncode({ code => $self->padval($anoncode->targ) }); } elsif ($kid->name eq "pushmark") { my $sib_name = $kid->sibling->name; if ($sib_name eq 'entersub') { diff --git a/op.c b/op.c index f26f0d3..e142bec 100644 --- a/op.c +++ b/op.c @@ -5268,9 +5268,8 @@ Perl_pmruntime(pTHX_ OP *o, OP *expr, bool isreg, I32 floor) * ------ ------------------- * pushmark (for regcomp) * pushmark (for entersub) - * pushmark (for refgen) * anoncode - * refgen + * srefgen * entersub * regcreset regcreset * pushmark pushmark diff --git a/opcode.h b/opcode.h index 9773408..ca1f836 100644 --- a/opcode.h +++ b/opcode.h @@ -1758,7 +1758,7 @@ EXTCONST U32 PL_opargs[] = { 0x00000144, /* rv2sv */ 0x00000104, /* av2arylen */ 0x00000140, /* rv2cv */ - 0x00000600, /* anoncode */ + 0x00000604, /* anoncode */ 0x00001b04, /* prototype */ 0x00002101, /* refgen */ 0x00001106, /* srefgen */ diff --git a/regen/opcodes b/regen/opcodes index 1e55ecb..6c3f63e 100644 --- a/regen/opcodes +++ b/regen/opcodes @@ -64,7 +64,7 @@ rv2gv ref-to-glob cast ck_rvconst ds1 rv2sv scalar dereference ck_rvconst ds1 av2arylen array length ck_null is1 rv2cv subroutine dereference ck_rvconst d1 -anoncode anonymous subroutine ck_anoncode $ +anoncode anonymous subroutine ck_anoncode s$ prototype subroutine prototype ck_null s% S refgen reference constructor ck_spair m1 L srefgen single ref constructor ck_null fs1 S -- Perl5 Master Repository
