summaryrefslogtreecommitdiff
path: root/pp_sort.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-07-11 14:42:56 +0100
committerDavid Mitchell <davem@iabyn.com>2016-02-03 08:59:36 +0000
commit1dfbe6b4adf94405803bd5ecb5c549061eaede69 (patch)
treee3fa75fc5900c7f0e5b15e23bc55d182a1ac3a32 /pp_sort.c
parent39f959b3924aabef92cdea5372e354a1e158f871 (diff)
downloadperl-1dfbe6b4adf94405803bd5ecb5c549061eaede69.tar.gz
add old_tmpsfloor field to CXt_SUB context frame
Rather than saving and restoring PL_tmps_floor on subroutine entry/exit by using SAVETMPS and the save stack, store the old value directly in the context struct and make PUSHSUB/POPSUB handle the saving and restoring.
Diffstat (limited to 'pp_sort.c')
-rw-r--r--pp_sort.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/pp_sort.c b/pp_sort.c
index df4c05f1af..f4664f9569 100644
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -1672,7 +1672,6 @@ PP(pp_sort)
if (!(flags & OPf_SPECIAL)) {
cx->cx_type = CXt_SUB;
PUSHSUB(cx);
- SAVETMPS;
if (!is_xsub) {
PADLIST * const padlist = CvPADLIST(cv);
@@ -1692,8 +1691,12 @@ PP(pp_sort)
}
}
- else
- SAVETMPS;
+ else {
+ /* mimic PUSHSUB. Note that we're cheating and using a
+ * CXt_NULL block as a CXt_SUB block */
+ cx->blk_sub.old_tmpsfloor = PL_tmps_floor;
+ PL_tmps_floor = PL_tmps_ix;
+ }
cx->cx_type |= CXp_MULTICALL;
@@ -1710,6 +1713,10 @@ PP(pp_sort)
POPSUB(cx, sv);
LEAVESUB(sv);
}
+ else
+ /* mimic POPSUB */
+ PL_tmps_floor = cx->blk_sub.old_tmpsfloor;
+
POPBLOCK(cx,PL_curpm);
PL_stack_sp = newsp;
POPSTACK;