In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/3c1e67acf7ef53180a12a2904a6a8ceb2bbfd512?hp=96dcbc3791f8077935704b73ec8cd4e1dbde2883>
- Log ----------------------------------------------------------------- commit 3c1e67acf7ef53180a12a2904a6a8ceb2bbfd512 Author: Daniel Dragan <bul...@hotmail.com> Date: Sun Jul 13 06:48:25 2014 -0400 refactor pp_ref similar to commmit b3cf48215c -removed: -4/-8 pop on SP +4/+8 push on SP PUTBACK 1 non vol register save/restore (TARG not saved across the sv_ref()) TARG is not computed if the SV isn't a reference, so the PL_sv_no branch is slightly faster. On VC 2003 32 bit miniperl, this func dropped from 0x6D to 0x58 bytes of machine code. ----------------------------------------------------------------------- Summary of changes: pp.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/pp.c b/pp.c index 3751bb4..bc7c0df 100644 --- a/pp.c +++ b/pp.c @@ -586,16 +586,21 @@ S_refto(pTHX_ SV *sv) PP(pp_ref) { - dSP; dTARGET; - SV * const sv = POPs; + dSP; + SV * const sv = TOPs; SvGETMAGIC(sv); if (!SvROK(sv)) - RETPUSHNO; + SETs(&PL_sv_no); + else { + dTARGET; + SETs(TARG); + /* use the return value that is in a register, its the same as TARG */ + TARG = sv_ref(TARG,SvRV(sv),TRUE); + SvSETMAGIC(TARG); + } - (void)sv_ref(TARG,SvRV(sv),TRUE); - PUSHTARG; - RETURN; + return NORMAL; } PP(pp_bless) -- Perl5 Master Repository