summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2011-10-07 15:38:56 +0100
committerDavid Mitchell <davem@iabyn.com>2011-10-07 20:07:48 +0100
commit9a214eecd07ed44274740f81d8dce0e526badf80 (patch)
tree1e33a4db9f23d13f72f267978a83a39188677a11 /pp_ctl.c
parentd0c0e7dd0ccf3d5c2f658529d3ee578a0bcb116e (diff)
downloadperl-9a214eecd07ed44274740f81d8dce0e526badf80.tar.gz
make SVs_PADTMP and SVs_PADSTALE share a bit
SVs_PADSTALE is only meaningful with SVs_PADMY, while SVs_PADTMP is only meaningful with !SVs_PADMY, so let them share the same flag bit. Note that this doesn't yet free a bit in SvFLAGS, as the two bits are also used for SVpad_STATE, SVpad_TYPED. (This is is follow-on to 62bb6514085e5eddc42b4fdaf3713ccdb7f1da85.)
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 692fdebd0d..24067618e3 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2082,11 +2082,17 @@ PP(pp_dbstate)
STATIC SV **
S_adjust_stack_on_leave(pTHX_ SV **newsp, SV **sp, SV **mark, I32 gimme, U32 flags)
{
+ bool padtmp = 0;
PERL_ARGS_ASSERT_ADJUST_STACK_ON_LEAVE;
+ if (flags & SVs_PADTMP) {
+ flags &= ~SVs_PADTMP;
+ padtmp = 1;
+ }
if (gimme == G_SCALAR) {
if (MARK < SP)
- *++newsp = (SvFLAGS(*SP) & flags) ? *SP : sv_mortalcopy(*SP);
+ *++newsp = ((SvFLAGS(*SP) & flags) || (padtmp && SvPADTMP(*SP)))
+ ? *SP : sv_mortalcopy(*SP);
else {
/* MEXTEND() only updates MARK, so reuse it instead of newsp. */
MARK = newsp;
@@ -2098,7 +2104,7 @@ S_adjust_stack_on_leave(pTHX_ SV **newsp, SV **sp, SV **mark, I32 gimme, U32 fla
else if (gimme == G_ARRAY) {
/* in case LEAVE wipes old return values */
while (++MARK <= SP) {
- if (SvFLAGS(*MARK) & flags)
+ if ((SvFLAGS(*MARK) & flags) || (padtmp && SvPADTMP(*MARK)))
*++newsp = *MARK;
else {
*++newsp = sv_mortalcopy(*MARK);