cx->blk_sub.dfoutgv = PL_defoutgv; \
(void)SvREFCNT_inc(cx->blk_sub.dfoutgv)
-#define POPSUB(cx) \
- { struct block_sub cxsub; \
- POPSUB1(cx); \
- POPSUB2(); }
-
-#define POPSUB1(cx) \
- cxsub = cx->blk_sub; /* because DESTROY may clobber *cx */
-
#ifdef USE_THREADS
#define POPSAVEARRAY() NOOP
#else
#define POPSAVEARRAY() \
STMT_START { \
SvREFCNT_dec(GvAV(PL_defgv)); \
- GvAV(PL_defgv) = cxsub.savearray; \
+ GvAV(PL_defgv) = cx->blk_sub.savearray; \
} STMT_END
#endif /* USE_THREADS */
-#define POPSUB2() \
- if (cxsub.hasargs) { \
+#define POPSUB(cx) \
+ if (cx->blk_sub.hasargs) { \
POPSAVEARRAY(); \
/* abandon @_ if it got reified */ \
- if (AvREAL(cxsub.argarray)) { \
- SSize_t fill = AvFILLp(cxsub.argarray); \
- SvREFCNT_dec(cxsub.argarray); \
- cxsub.argarray = newAV(); \
- av_extend(cxsub.argarray, fill); \
- AvFLAGS(cxsub.argarray) = AVf_REIFY; \
- PL_curpad[0] = (SV*)cxsub.argarray; \
+ if (AvREAL(cx->blk_sub.argarray)) { \
+ SSize_t fill = AvFILLp(cx->blk_sub.argarray); \
+ SvREFCNT_dec(cx->blk_sub.argarray); \
+ cx->blk_sub.argarray = newAV(); \
+ av_extend(cx->blk_sub.argarray, fill); \
+ AvFLAGS(cx->blk_sub.argarray) = AVf_REIFY; \
+ PL_curpad[0] = (SV*)cx->blk_sub.argarray; \
} \
} \
- if (cxsub.cv) { \
- if (!(CvDEPTH(cxsub.cv) = cxsub.olddepth)) \
- SvREFCNT_dec(cxsub.cv); \
+ if (cx->blk_sub.cv) { \
+ if (!(CvDEPTH(cx->blk_sub.cv) = cx->blk_sub.olddepth)) \
+ SvREFCNT_dec(cx->blk_sub.cv); \
}
#define POPFORMAT(cx) \
#define PUSHEVAL(cx,n,fgv) \
cx->blk_eval.old_in_eval = PL_in_eval; \
- cx->blk_eval.old_op_type = PL_op->op_type; \
+ cx->blk_eval.old_op_type = PL_op->op_type; \
cx->blk_eval.old_name = n; \
- cx->blk_eval.old_eval_root = PL_eval_root; \
+ cx->blk_eval.old_eval_root = PL_eval_root; \
cx->blk_eval.cur_text = PL_linestr;
#define POPEVAL(cx) \
cx->blk_loop.iterix = -1;
#define POPLOOP(cx) \
- { struct block_loop cxloop; \
- POPLOOP1(cx); \
- POPLOOP2(); }
-
-#define POPLOOP1(cx) \
- cxloop = cx->blk_loop; /* because DESTROY may clobber *cx */ \
- newsp = PL_stack_base + cxloop.resetsp;
-
-#define POPLOOP2() \
- SvREFCNT_dec(cxloop.iterlval); \
- if (cxloop.itervar) { \
- sv_2mortal(*cxloop.itervar); \
- *cxloop.itervar = cxloop.itersave; \
+ SvREFCNT_dec(cx->blk_loop.iterlval); \
+ if (cx->blk_loop.itervar) { \
+ sv_2mortal(*(cx->blk_loop.itervar)); \
+ *(cx->blk_loop.itervar) = cx->blk_loop.itersave; \
} \
- if (cxloop.iterary && cxloop.iterary != PL_curstack) \
- SvREFCNT_dec(cxloop.iterary);
+ if (cx->blk_loop.iterary && cx->blk_loop.iterary != PL_curstack)\
+ SvREFCNT_dec(cx->blk_loop.iterary);
/* context common to subroutines, evals and loops */
struct block {
{
djSP;
register PERL_CONTEXT *cx;
- struct block_loop cxloop;
I32 gimme;
SV **newsp;
PMOP *newpm;
POPBLOCK(cx,newpm);
mark = newsp;
- POPLOOP1(cx); /* Delay POPLOOP2 until stack values are safe */
+ newsp = PL_stack_base + cx->blk_loop.resetsp;
TAINT_NOT;
if (gimme == G_VOID)
SP = newsp;
PUTBACK;
- POPLOOP2(); /* Stack values are safe: release loop vars ... */
+ POPLOOP(cx); /* Stack values are safe: release loop vars ... */
PL_curpm = newpm; /* ... and pop $1 et al */
LEAVE;
djSP; dMARK;
I32 cxix;
register PERL_CONTEXT *cx;
- struct block_sub cxsub;
bool popsub2 = FALSE;
I32 gimme;
SV **newsp;
POPBLOCK(cx,newpm);
switch (CxTYPE(cx)) {
case CXt_SUB:
- POPSUB1(cx); /* Delay POPSUB2 until stack values are safe */
popsub2 = TRUE;
break;
case CXt_EVAL:
if (gimme == G_SCALAR) {
if (MARK < SP) {
if (popsub2) {
- if (cxsub.cv && CvDEPTH(cxsub.cv) > 1) {
+ if (cx->blk_sub.cv && CvDEPTH(cx->blk_sub.cv) > 1) {
if (SvTEMP(TOPs)) {
*++newsp = SvREFCNT_inc(*SP);
FREETMPS;
/* Stack values are safe: */
if (popsub2) {
- POPSUB2(); /* release CV and @_ ... */
+ POPSUB(cx); /* release CV and @_ ... */
}
PL_curpm = newpm; /* ... and pop $1 et al */
djSP;
I32 cxix;
register PERL_CONTEXT *cx;
- struct block_loop cxloop;
- struct block_sub cxsub;
I32 pop2 = 0;
I32 gimme;
I32 optype;
OP *nextop;
SV **newsp;
PMOP *newpm;
- SV **mark = PL_stack_base + cxstack[cxstack_ix].blk_oldsp;
+ SV **mark;
if (PL_op->op_flags & OPf_SPECIAL) {
cxix = dopoptoloop(cxstack_ix);
dounwind(cxix);
POPBLOCK(cx,newpm);
+ mark = newsp;
switch (CxTYPE(cx)) {
case CXt_LOOP:
- POPLOOP1(cx); /* Delay POPLOOP2 until stack values are safe */
pop2 = CXt_LOOP;
- nextop = cxloop.last_op->op_next;
+ newsp = PL_stack_base + cx->blk_loop.resetsp;
+ nextop = cx->blk_loop.last_op->op_next;
break;
case CXt_SUB:
- POPSUB1(cx); /* Delay POPSUB2 until stack values are safe */
pop2 = CXt_SUB;
nextop = pop_return();
break;
/* Stack values are safe: */
switch (pop2) {
case CXt_LOOP:
- POPLOOP2(); /* release loop vars ... */
+ POPLOOP(cx); /* release loop vars ... */
LEAVE;
break;
case CXt_SUB:
- POPSUB2(); /* release CV and @_ ... */
+ POPSUB(cx); /* release CV and @_ ... */
break;
}
PL_curpm = newpm; /* ... and pop $1 et al */
PMOP *newpm;
I32 gimme;
register PERL_CONTEXT *cx;
- struct block_sub cxsub;
POPBLOCK(cx,newpm);
- POPSUB1(cx); /* Delay POPSUB2 until stack values are safe */
TAINT_NOT;
if (gimme == G_SCALAR) {
MARK = newsp + 1;
if (MARK <= SP) {
- if (cxsub.cv && CvDEPTH(cxsub.cv) > 1) {
+ if (cx->blk_sub.cv && CvDEPTH(cx->blk_sub.cv) > 1) {
if (SvTEMP(TOPs)) {
*MARK = SvREFCNT_inc(TOPs);
FREETMPS;
}
PUTBACK;
- POPSUB2(); /* Stack values are safe: release CV and @_ ... */
+ POPSUB(cx); /* Stack values are safe: release CV and @_ ... */
PL_curpm = newpm; /* ... and pop $1 et al */
LEAVE;
PMOP *newpm;
I32 gimme;
register PERL_CONTEXT *cx;
- struct block_sub cxsub;
POPBLOCK(cx,newpm);
- POPSUB1(cx); /* Delay POPSUB2 until stack values are safe */
TAINT_NOT;
if (gimme == G_SCALAR)
goto temporise;
if (gimme == G_ARRAY) {
- if (!CvLVALUE(cxsub.cv))
+ if (!CvLVALUE(cx->blk_sub.cv))
goto temporise_array;
EXTEND_MORTAL(SP - newsp);
for (mark = newsp + 1; mark <= SP; mark++) {
/* Here we go for robustness, not for speed, so we change all
* the refcounts so the caller gets a live guy. Cannot set
* TEMP, so sv_2mortal is out of question. */
- if (!CvLVALUE(cxsub.cv)) {
- POPSUB2();
+ if (!CvLVALUE(cx->blk_sub.cv)) {
+ POPSUB(cx);
PL_curpm = newpm;
DIE(aTHX_ "Can't modify non-lvalue subroutine call");
}
EXTEND_MORTAL(1);
if (MARK == SP) {
if (SvFLAGS(TOPs) & (SVs_TEMP | SVs_PADTMP | SVf_READONLY)) {
- POPSUB2();
+ POPSUB(cx);
PL_curpm = newpm;
DIE(aTHX_ "Can't return a %s from lvalue subroutine",
SvREADONLY(TOPs) ? "readonly value" : "temporary");
}
}
else { /* Should not happen? */
- POPSUB2();
+ POPSUB(cx);
PL_curpm = newpm;
DIE(aTHX_ "%s returned from lvalue subroutine in scalar context",
(MARK > SP ? "Empty array" : "Array"));
if (SvFLAGS(*mark) & (SVs_TEMP | SVs_PADTMP | SVf_READONLY)) {
/* Might be flattened array after $#array = */
PUTBACK;
- POPSUB2();
+ POPSUB(cx);
PL_curpm = newpm;
DIE(aTHX_ "Can't return %s from lvalue subroutine",
(*mark != &PL_sv_undef)
temporise:
MARK = newsp + 1;
if (MARK <= SP) {
- if (cxsub.cv && CvDEPTH(cxsub.cv) > 1) {
+ if (cx->blk_sub.cv && CvDEPTH(cx->blk_sub.cv) > 1) {
if (SvTEMP(TOPs)) {
*MARK = SvREFCNT_inc(TOPs);
FREETMPS;
}
PUTBACK;
- POPSUB2(); /* Stack values are safe: release CV and @_ ... */
+ POPSUB(cx); /* Stack values are safe: release CV and @_ ... */
PL_curpm = newpm; /* ... and pop $1 et al */
LEAVE;