diff options
author | David Mitchell <davem@iabyn.com> | 2015-07-11 14:42:56 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2016-02-03 08:59:36 +0000 |
commit | 1dfbe6b4adf94405803bd5ecb5c549061eaede69 (patch) | |
tree | e3fa75fc5900c7f0e5b15e23bc55d182a1ac3a32 /pp_sort.c | |
parent | 39f959b3924aabef92cdea5372e354a1e158f871 (diff) | |
download | perl-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.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -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; |