summaryrefslogtreecommitdiff
path: root/cop.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-12-31 10:39:17 +0000
committerDavid Mitchell <davem@iabyn.com>2016-02-03 09:19:21 +0000
commit35095fd084a83612cb66208fd8ea578b54ce3c17 (patch)
treed84d277146b0f8b8cca1b991299c4164b7a4bf63 /cop.h
parentce8bb8d8f4560e4f446421504084358642037eb9 (diff)
downloadperl-35095fd084a83612cb66208fd8ea578b54ce3c17.tar.gz
MULTICALL *shouldn't* clear savestack
About 25 commits ago in this branch I added a commit: MULTICALL should clear scope after each call To fix RT #116577, which reported that lexicals were only being freed at the end of the MULTICALL, not after each individual call to the sub. In that commit, I added a LEAVE_SCOPE() to the end of the MULTICALL() definition. However, after further thought I realise that's wrong. If a multicall sub does something like { my $x = $_*2; $x }, then the returned value would be freed before the XS code which calls MULTICALL() has a chance to do anything with it (e.g. test for truth, or add it to the return args or whatever). So I think popping the save stack should be the responsibility of the caller of MULTICALL(), rather than of MULTICALL() itself.
Diffstat (limited to 'cop.h')
-rw-r--r--cop.h5
1 files changed, 1 insertions, 4 deletions
diff --git a/cop.h b/cop.h
index 269bdebbc6..16254eca02 100644
--- a/cop.h
+++ b/cop.h
@@ -1083,8 +1083,7 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>.
#define dMULTICALL \
OP *multicall_cop; \
- bool multicall_oldcatch; \
- I32 multicall_saveix_floor
+ bool multicall_oldcatch
#define PUSH_MULTICALL(the_cv) \
PUSH_MULTICALL_FLAGS(the_cv, 0)
@@ -1105,7 +1104,6 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>.
PL_stack_sp, PL_savestack_ix); \
cx_pushsub(cx, cv, NULL, 0); \
SAVEOP(); \
- multicall_saveix_floor = PL_savestack_ix; \
if (!(flags & CXp_SUB_RE_FAKE)) \
CvDEPTH(cv)++; \
if (CvDEPTH(cv) >= 2) \
@@ -1118,7 +1116,6 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>.
STMT_START { \
PL_op = multicall_cop; \
CALLRUNOPS(aTHX); \
- LEAVE_SCOPE(multicall_saveix_floor); \
} STMT_END
#define POP_MULTICALL \