summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2003-08-24 16:52:00 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-08-26 19:13:39 +0000
commit5dd42e15760f2e77ab3979bfe1b6aafaa9ff1227 (patch)
tree0afca94ca8522b7c1ac1afeea67258cd0ce57290 /pp_hot.c
parentd7f1a795527ad4875d71a2e977851f754d4b7b3f (diff)
downloadperl-5dd42e15760f2e77ab3979bfe1b6aafaa9ff1227.tar.gz
improved 19064 (local $_[0] problems)
Message-ID: <20030824145159.GA12210@fdgroup.com> p4raw-id: //depot/perl@20909
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 8b31f0b1bb..765f091979 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2291,6 +2291,7 @@ PP(pp_leavesub)
SV *sv;
POPBLOCK(cx,newpm);
+ cxstack_ix++; /* temporarily protect top context */
TAINT_NOT;
if (gimme == G_SCALAR) {
@@ -2328,10 +2329,11 @@ PP(pp_leavesub)
}
PUTBACK;
+ LEAVE;
+ cxstack_ix--;
POPSUB(cx,sv); /* Stack values are safe: release CV and @_ ... */
PL_curpm = newpm; /* ... and pop $1 et al */
- LEAVE;
LEAVESUB(sv);
return pop_return();
}
@@ -2349,6 +2351,7 @@ PP(pp_leavesublv)
SV *sv;
POPBLOCK(cx,newpm);
+ cxstack_ix++; /* temporarily protect top context */
TAINT_NOT;
@@ -2384,9 +2387,10 @@ PP(pp_leavesublv)
* the refcounts so the caller gets a live guy. Cannot set
* TEMP, so sv_2mortal is out of question. */
if (!CvLVALUE(cx->blk_sub.cv)) {
+ LEAVE;
+ cxstack_ix--;
POPSUB(cx,sv);
PL_curpm = newpm;
- LEAVE;
LEAVESUB(sv);
DIE(aTHX_ "Can't modify non-lvalue subroutine call");
}
@@ -2395,9 +2399,10 @@ PP(pp_leavesublv)
EXTEND_MORTAL(1);
if (MARK == SP) {
if (SvFLAGS(TOPs) & (SVs_TEMP | SVs_PADTMP | SVf_READONLY)) {
+ LEAVE;
+ cxstack_ix--;
POPSUB(cx,sv);
PL_curpm = newpm;
- LEAVE;
LEAVESUB(sv);
DIE(aTHX_ "Can't return %s from lvalue subroutine",
SvREADONLY(TOPs) ? (TOPs == &PL_sv_undef) ? "undef"
@@ -2410,9 +2415,10 @@ PP(pp_leavesublv)
}
}
else { /* Should not happen? */
+ LEAVE;
+ cxstack_ix--;
POPSUB(cx,sv);
PL_curpm = newpm;
- LEAVE;
LEAVESUB(sv);
DIE(aTHX_ "%s returned from lvalue subroutine in scalar context",
(MARK > SP ? "Empty array" : "Array"));
@@ -2426,9 +2432,10 @@ PP(pp_leavesublv)
&& SvFLAGS(*mark) & (SVs_TEMP | SVs_PADTMP | SVf_READONLY)) {
/* Might be flattened array after $#array = */
PUTBACK;
+ LEAVE;
+ cxstack_ix--;
POPSUB(cx,sv);
PL_curpm = newpm;
- LEAVE;
LEAVESUB(sv);
DIE(aTHX_ "Can't return a %s from lvalue subroutine",
SvREADONLY(TOPs) ? "readonly value" : "temporary");
@@ -2480,10 +2487,11 @@ PP(pp_leavesublv)
}
PUTBACK;
+ LEAVE;
+ cxstack_ix--;
POPSUB(cx,sv); /* Stack values are safe: release CV and @_ ... */
PL_curpm = newpm; /* ... and pop $1 et al */
- LEAVE;
LEAVESUB(sv);
return pop_return();
}