summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-12-16 14:52:22 +0000
committerDavid Mitchell <davem@iabyn.com>2016-02-03 09:18:34 +0000
commite02ce34b5a3c7daaf3131c6aea9a98f7dbbba1b5 (patch)
tree80fbfa076ae8ddbcc3fba3177d9ef0f7826f5616 /pp_ctl.c
parent799da9d7a389d2e825fba9c63b2f6876513385c7 (diff)
downloadperl-e02ce34b5a3c7daaf3131c6aea9a98f7dbbba1b5.tar.gz
make pp_return() use leave_adjust_stacks()
It was using S_leave_common(), but that's shortly to be removed. It also required adding an extra arg to leave_adjust_stacks() to indicate where to shift the return args to. This will also be needed for when we replace the remaining uses of S_leave_common() with leave_adjust_stacks().
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index ff1fb42313..69b24468a2 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2355,7 +2355,7 @@ PP(pp_leavesublv)
}
ok:
- leave_adjust_stacks(oldsp, gimme, is_lval ? 3 : 2);
+ leave_adjust_stacks(oldsp, oldsp, gimme, is_lval ? 3 : 2);
if (lval & OPpDEREF) {
/* lval_sub()->{...} and similar */
@@ -2392,7 +2392,7 @@ PP(pp_leavesublv)
}
}
- leave_adjust_stacks(oldsp, gimme, is_lval ? 3 : 2);
+ leave_adjust_stacks(oldsp, oldsp, gimme, is_lval ? 3 : 2);
}
}
@@ -2451,19 +2451,20 @@ PP(pp_return)
* We may also need to shift the args down; for example,
* for (1,2) { return 3,4 }
* leaves 1,2,3,4 on the stack. Both these actions can be done by
- * leave_common(). By calling it with lvalue=TRUE, we just bump
- * the ref count and mortalise the args that need it. The "scan
- * the args and maybe copy them" process will be repeated by
- * whoever we tail-call (e.g. pp_leaveeval), where any copying etc
- * will be done. That is to say, in this code path two scans of
- * the args will be done; the first just shifts and preserves; the
- * second is the "real" arg processing, based on the type of
- * return.
+ * leave_adjust_stacks(). By calling it with and lvalue "pass
+ * all" action, we just bump the ref count and mortalise the args
+ * that need it, do a FREETMPS. The "scan the args and maybe copy
+ * them" process will be repeated by whoever we tail-call (e.g.
+ * pp_leaveeval), where any copying etc will be done. That is to
+ * say, in this code path two scans of the args will be done; the
+ * first just shifts and preserves; the second is the "real" arg
+ * processing, based on the type of return.
*/
cx = &cxstack[cxix];
PUTBACK;
- leave_common(PL_stack_base + cx->blk_oldsp, MARK,
- cx->blk_gimme, SVs_TEMP|SVs_PADTMP, TRUE);
+ if (cx->blk_gimme != G_VOID)
+ leave_adjust_stacks(MARK, PL_stack_base + cx->blk_oldsp,
+ cx->blk_gimme, 3);
SPAGAIN;
dounwind(cxix);
cx = &cxstack[cxix]; /* CX stack may have been realloced */