summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorDaniel Dragan <bulk88@hotmail.com>2014-07-13 06:48:25 -0400
committerTony Cook <tony@develop-help.com>2014-07-14 16:09:24 +1000
commit3c1e67acf7ef53180a12a2904a6a8ceb2bbfd512 (patch)
tree9b928fb6ebfb85996ceb6107ffe1dd6cbc1fa3b1 /pp.c
parent96dcbc3791f8077935704b73ec8cd4e1dbde2883 (diff)
downloadperl-3c1e67acf7ef53180a12a2904a6a8ceb2bbfd512.tar.gz
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.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/pp.c b/pp.c
index 3751bb41ea..bc7c0dfacc 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)