dSP;
ENTER;
SAVETMPS;
- PUSHSTACK(SI_MAGIC);
+ PUSHSTACKi(SI_MAGIC);
PUSHMARK(SP);
EXTEND(SP,2);
PUSHs(mg->mg_obj);
PUSHs(sv_2mortal(newSViv(key+1)));
PUTBACK;
perl_call_method("EXTEND", G_SCALAR|G_DISCARD);
- POPSTACK();
+ POPSTACK;
FREETMPS;
LEAVE;
return;
if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
dSP;
- PUSHSTACK(SI_MAGIC);
+ PUSHSTACKi(SI_MAGIC);
PUSHMARK(SP);
EXTEND(SP,2);
PUSHs(mg->mg_obj);
ENTER;
perl_call_method("PUSH", G_SCALAR|G_DISCARD);
LEAVE;
- POPSTACK();
+ POPSTACK;
return;
}
av_store(av,AvFILLp(av)+1,val);
croak(no_modify);
if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
dSP;
- PUSHSTACK(SI_MAGIC);
+ PUSHSTACKi(SI_MAGIC);
PUSHMARK(SP);
XPUSHs(mg->mg_obj);
PUTBACK;
retval = &sv_undef;
}
LEAVE;
- POPSTACK();
+ POPSTACK;
return retval;
}
retval = AvARRAY(av)[AvFILLp(av)];
if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
dSP;
- PUSHSTACK(SI_MAGIC);
+ PUSHSTACKi(SI_MAGIC);
PUSHMARK(SP);
EXTEND(SP,1+num);
PUSHs(mg->mg_obj);
ENTER;
perl_call_method("UNSHIFT", G_SCALAR|G_DISCARD);
LEAVE;
- POPSTACK();
+ POPSTACK;
return;
}
croak(no_modify);
if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
dSP;
- PUSHSTACK(SI_MAGIC);
+ PUSHSTACKi(SI_MAGIC);
PUSHMARK(SP);
XPUSHs(mg->mg_obj);
PUTBACK;
retval = &sv_undef;
}
LEAVE;
- POPSTACK();
+ POPSTACK;
return retval;
}
retval = *AvARRAY(av);
dSP;
ENTER;
SAVETMPS;
- PUSHSTACK(SI_MAGIC);
+ PUSHSTACKi(SI_MAGIC);
PUSHMARK(SP);
EXTEND(SP,2);
PUSHs(mg->mg_obj);
PUSHs(sv_2mortal(newSViv(fill+1)));
PUTBACK;
perl_call_method("STORESIZE", G_SCALAR|G_DISCARD);
- POPSTACK();
+ POPSTACK;
FREETMPS;
LEAVE;
return;
* This ensures magic doesn't invalidate local stack and cx pointers.
*/
+#define SI_UNKNOWN -1
#define SI_UNDEF 0
#define SI_MAIN 1
#define SI_MAGIC 2
#define SI_DESTROY 6
#define SI_WARNHOOK 7
#define SI_DIEHOOK 8
+#define SI_REQUIRE 9
struct stackinfo {
AV * si_stack; /* stack for current runlevel */
# define SET_MARKBASE NOOP
#endif
-#define PUSHSTACK(type) \
+#define PUSHSTACKi(type) \
STMT_START { \
PERL_SI *next = curstackinfo->si_next; \
if (!next) { \
SET_MARKBASE; \
} STMT_END
-#define POPSTACK() \
+#define PUSHSTACK PUSHSTACKi(SI_UNKNOWN)
+
+#define POPSTACK \
STMT_START { \
PERL_SI *prev = curstackinfo->si_prev; \
if (!prev) { \
STMT_START { \
while (curstack != s) { \
dounwind(-1); \
- POPSTACK(); \
+ POPSTACK; \
} \
} STMT_END
myop.op_next = Nullop;
myop.op_flags = OPf_WANT_SCALAR | OPf_STACKED;
- PUSHSTACK(SI_OVERLOAD);
+ PUSHSTACKi(SI_OVERLOAD);
ENTER;
SAVEOP();
op = (OP *) &myop;
SPAGAIN;
res=POPs;
- POPSTACK();
+ POPSTACK;
CATCH_SET(oldcatch);
if (postpr) {
ENTER;
SAVETMPS;
- PUSHSTACK(SI_MAGIC);
+ PUSHSTACKi(SI_MAGIC);
if (magic_methcall(mg, meth, G_SCALAR, 2, NULL)) {
sv_setsv(sv, *stack_sp--);
}
- POPSTACK();
+ POPSTACK;
FREETMPS;
LEAVE;
return 0;
{
dSP;
ENTER;
- PUSHSTACK(SI_MAGIC);
+ PUSHSTACKi(SI_MAGIC);
magic_methcall(mg, "STORE", G_SCALAR|G_DISCARD, 3, sv);
- POPSTACK();
+ POPSTACK;
LEAVE;
return 0;
}
ENTER;
SAVETMPS;
- PUSHSTACK(SI_MAGIC);
+ PUSHSTACKi(SI_MAGIC);
if (magic_methcall(mg, "FETCHSIZE", G_SCALAR, 2, NULL)) {
sv = *stack_sp--;
retval = (U32) SvIV(sv)-1;
}
- POPSTACK();
+ POPSTACK;
FREETMPS;
LEAVE;
return retval;
dSP;
ENTER;
- PUSHSTACK(SI_MAGIC);
+ PUSHSTACKi(SI_MAGIC);
PUSHMARK(SP);
XPUSHs(mg->mg_obj);
PUTBACK;
perl_call_method("CLEAR", G_SCALAR|G_DISCARD);
- POPSTACK();
+ POPSTACK;
LEAVE;
return 0;
}
ENTER;
SAVETMPS;
- PUSHSTACK(SI_MAGIC);
+ PUSHSTACKi(SI_MAGIC);
PUSHMARK(SP);
EXTEND(SP, 2);
PUSHs(mg->mg_obj);
if (perl_call_method(meth, G_SCALAR))
sv_setsv(key, *stack_sp--);
- POPSTACK();
+ POPSTACK;
FREETMPS;
LEAVE;
return 0;
sv_setpv(sv,sig_name[sig]);
}
- PUSHSTACK(SI_SIGNAL);
+ PUSHSTACKi(SI_SIGNAL);
PUSHMARK(SP);
PUSHs(sv);
PUTBACK;
perl_call_sv((SV*)cv, G_DISCARD);
- POPSTACK();
+ POPSTACK;
cleanup:
if (flags & 1)
savestack_ix -= 8; /* Unprotect save in progress. */
void
perl_require_pv(char *pv)
{
- SV* sv = sv_newmortal();
+ SV* sv;
+ dSP;
+ PUSHSTACKi(SI_REQUIRE);
+ PUTBACK;
+ sv = sv_newmortal();
sv_setpv(sv, "require '");
sv_catpv(sv, pv);
sv_catpv(sv, "'");
perl_eval_sv(sv, G_DISCARD);
+ SPAGAIN;
+ POPSTACK;
}
void
SAVEOP();
CATCH_SET(TRUE);
- PUSHSTACK(SI_SORT);
+ PUSHSTACKi(SI_SORT);
if (sortstash != stash) {
firstgv = gv_fetchpv("a", TRUE, SVt_PV);
secondgv = gv_fetchpv("b", TRUE, SVt_PV);
qsortsv((myorigmark+1), max, FUNC_NAME_TO_PTR(sortcv));
POPBLOCK(cx,curpm);
- POPSTACK();
+ POPSTACK;
CATCH_SET(oldcatch);
}
}
while ((cxix = dopoptoeval(cxstack_ix)) < 0 && curstackinfo->si_prev) {
dounwind(-1);
- POPSTACK();
+ POPSTACK;
}
if (cxix >= 0) {
items = SP - MARK++;
if (sv_isobject(*MARK)) {
ENTER;
- PUSHSTACK(SI_MAGIC);
+ PUSHSTACKi(SI_MAGIC);
PUSHMARK(SP);
EXTEND(SP,items);
while (items--)
methname, SvPV(*MARK,na));
}
ENTER;
- PUSHSTACK(SI_MAGIC);
+ PUSHSTACKi(SI_MAGIC);
PUSHMARK(SP);
EXTEND(SP,items);
while (items--)
SPAGAIN;
sv = TOPs;
- POPSTACK();
+ POPSTACK;
if (sv_isobject(sv)) {
sv_unmagic(varsv, how);
sv_magic(varsv, sv, how, Nullch, 0);
destructor = gv_fetchmethod(SvSTASH(sv), "DESTROY");
if (destructor) {
ENTER;
- PUSHSTACK(SI_DESTROY);
+ PUSHSTACKi(SI_DESTROY);
SvRV(&tmpref) = SvREFCNT_inc(sv);
EXTEND(SP, 2);
PUSHMARK(SP);
perl_call_sv((SV*)GvCV(destructor),
G_DISCARD|G_EVAL|G_KEEPERR);
SvREFCNT(sv)--;
- POPSTACK();
+ POPSTACK;
LEAVE;
}
} while (SvOBJECT(sv) && SvSTASH(sv) != stash);
msg = ERRSV;
}
- PUSHSTACK(SI_DIEHOOK);
+ PUSHSTACKi(SI_DIEHOOK);
PUSHMARK(SP);
XPUSHs(msg);
PUTBACK;
perl_call_sv((SV*)cv, G_DISCARD);
- POPSTACK();
+ POPSTACK;
LEAVE;
}
}
SvREADONLY_on(msg);
SAVEFREESV(msg);
- PUSHSTACK(SI_DIEHOOK);
+ PUSHSTACKi(SI_DIEHOOK);
PUSHMARK(SP);
XPUSHs(msg);
PUTBACK;
perl_call_sv((SV*)cv, G_DISCARD);
- POPSTACK();
+ POPSTACK;
LEAVE;
}
}
SvREADONLY_on(msg);
SAVEFREESV(msg);
- PUSHSTACK(SI_WARNHOOK);
+ PUSHSTACKi(SI_WARNHOOK);
PUSHMARK(SP);
XPUSHs(msg);
PUTBACK;
perl_call_sv((SV*)cv, G_DISCARD);
- POPSTACK();
+ POPSTACK;
LEAVE;
return;
}