+#define G_NODEBUG 32 /* Disable debugging at toplevel. */
+#define G_METHOD 64 /* Calling method. */
+
+/* flag bits for PL_in_eval */
+#define EVAL_NULL 0 /* not in an eval */
+#define EVAL_INEVAL 1 /* some enclosing scope is an eval */
+#define EVAL_WARNONLY 2 /* used by yywarn() when calling yyerror() */
+#define EVAL_KEEPERR 4 /* set by Perl_call_sv if G_KEEPERR */
+#define EVAL_INREQUIRE 8 /* The code is being required. */
+
+/* Support for switching (stack and block) contexts.
+ * This ensures magic doesn't invalidate local stack and cx pointers.
+ */
+
+#define PERLSI_UNKNOWN -1
+#define PERLSI_UNDEF 0
+#define PERLSI_MAIN 1
+#define PERLSI_MAGIC 2
+#define PERLSI_SORT 3
+#define PERLSI_SIGNAL 4
+#define PERLSI_OVERLOAD 5
+#define PERLSI_DESTROY 6
+#define PERLSI_WARNHOOK 7
+#define PERLSI_DIEHOOK 8
+#define PERLSI_REQUIRE 9
+
+struct stackinfo {
+ AV * si_stack; /* stack for current runlevel */
+ PERL_CONTEXT * si_cxstack; /* context stack for runlevel */
+ I32 si_cxix; /* current context index */
+ I32 si_cxmax; /* maximum allocated index */
+ I32 si_type; /* type of runlevel */
+ struct stackinfo * si_prev;
+ struct stackinfo * si_next;
+ I32 si_markoff; /* offset where markstack begins for us.
+ * currently used only with DEBUGGING,
+ * but not #ifdef-ed for bincompat */
+};
+
+typedef struct stackinfo PERL_SI;
+
+#define cxstack (PL_curstackinfo->si_cxstack)
+#define cxstack_ix (PL_curstackinfo->si_cxix)
+#define cxstack_max (PL_curstackinfo->si_cxmax)
+
+#ifdef DEBUGGING
+# define SET_MARK_OFFSET \
+ PL_curstackinfo->si_markoff = PL_markstack_ptr - PL_markstack
+#else
+# define SET_MARK_OFFSET NOOP
+#endif
+
+#define PUSHSTACKi(type) \
+ STMT_START { \
+ PERL_SI *next = PL_curstackinfo->si_next; \
+ if (!next) { \
+ next = new_stackinfo(32, 2048/sizeof(PERL_CONTEXT) - 1); \
+ next->si_prev = PL_curstackinfo; \
+ PL_curstackinfo->si_next = next; \
+ } \
+ next->si_type = type; \
+ next->si_cxix = -1; \
+ AvFILLp(next->si_stack) = 0; \
+ SWITCHSTACK(PL_curstack,next->si_stack); \
+ PL_curstackinfo = next; \
+ SET_MARK_OFFSET; \
+ } STMT_END
+
+#define PUSHSTACK PUSHSTACKi(PERLSI_UNKNOWN)
+
+/* POPSTACK works with PL_stack_sp, so it may need to be bracketed by
+ * PUTBACK/SPAGAIN to flush/refresh any local SP that may be active */
+#define POPSTACK \
+ STMT_START { \
+ djSP; \
+ PERL_SI *prev = PL_curstackinfo->si_prev; \
+ if (!prev) { \
+ PerlIO_printf(Perl_error_log, "panic: POPSTACK\n"); \
+ my_exit(1); \
+ } \
+ SWITCHSTACK(PL_curstack,prev->si_stack); \
+ /* don't free prev here, free them all at the END{} */ \
+ PL_curstackinfo = prev; \
+ } STMT_END
+
+#define POPSTACK_TO(s) \
+ STMT_START { \
+ while (PL_curstack != s) { \
+ dounwind(-1); \
+ POPSTACK; \
+ } \
+ } STMT_END