summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-12-27 10:41:41 +0000
committerDavid Mitchell <davem@iabyn.com>2016-02-03 09:19:19 +0000
commit2ef9a108812a6ae3c346882b7338742e392deb89 (patch)
tree7a6c2003ff6f9a17142adf21a1782e102ae112d8 /scope.c
parent490576d1e8ab582703d23e8ba95d5e4a881c04dc (diff)
downloadperl-2ef9a108812a6ae3c346882b7338742e392deb89.tar.gz
add SAVEt_TMPSFLOOR save type and Perl_savetmps()
By making SAVETMPS have its own dedicated save type, it avoids having to push the address of PL_tmps_floor onto the save stack each time. By also giving it a dedicated save function, the function can do the PL_tmpsfloor = PL_tmps_ix step too, making the binary slightly more compact.
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/scope.c b/scope.c
index db2fef1335..f1d1ccbe80 100644
--- a/scope.c
+++ b/scope.c
@@ -731,6 +731,18 @@ Perl_save_svref(pTHX_ SV **sptr)
return save_scalar_at(sptr, SAVEf_SETMAGIC); /* XXX - FIXME - see #60360 */
}
+
+void
+Perl_savetmps(pTHX)
+{
+ dSS_ADD;
+ SS_ADD_IV(PL_tmps_floor);
+ PL_tmps_floor = PL_tmps_ix;
+ SS_ADD_UV(SAVEt_TMPSFLOOR);
+ SS_ADD_END(2);
+}
+
+
I32
Perl_save_alloc(pTHX_ I32 size, I32 pad)
{
@@ -945,6 +957,9 @@ Perl_leave_scope(pTHX_ I32 base)
case SAVEt_STRLEN: /* STRLEN/size_t ref */
*(STRLEN*)ARG0_PTR = (STRLEN)arg1.any_iv;
break;
+ case SAVEt_TMPSFLOOR: /* restore PL_tmps_floor */
+ PL_tmps_floor = (SSize_t)arg0.any_iv;
+ break;
case SAVEt_BOOL: /* bool reference */
*(bool*)ARG0_PTR = cBOOL(uv >> 8);
#ifdef NO_TAINT_SUPPORT