In struct block_eval, access the members old_in_eval and old_op_type
Nicholas Clark [Mon, 21 Jan 2008 15:14:35 +0000 (15:14 +0000)]
via macros CxOLD_IN_EVAL() and CxOLD_OP_TYPE(), which will allow the
storage location to be changed.

p4raw-id: //depot/perl@33029

cop.h
pp_ctl.c
scope.c

diff --git a/cop.h b/cop.h
index fafa441..adfc51f 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -402,6 +402,9 @@ struct block_eval {
     JMPENV *   cur_top_env; /* value of PL_top_env when eval CX created */
 };
 
+#define CxOLD_IN_EVAL(cx)      (0 + (cx)->blk_eval.old_in_eval)
+#define CxOLD_OP_TYPE(cx)      (0 + (cx)->blk_eval.old_op_type)
+
 #define PUSHEVAL(cx,n,fgv)                                             \
     STMT_START {                                                       \
        cx->blk_eval.old_in_eval = PL_in_eval;                          \
@@ -416,8 +419,8 @@ struct block_eval {
 
 #define POPEVAL(cx)                                                    \
     STMT_START {                                                       \
-       PL_in_eval = cx->blk_eval.old_in_eval;                          \
-       optype = cx->blk_eval.old_op_type;                              \
+       PL_in_eval = CxOLD_IN_EVAL(cx);                                 \
+       optype = CxOLD_OP_TYPE(cx);                                     \
        PL_eval_root = cx->blk_eval.old_eval_root;                      \
        if (cx->blk_eval.old_namesv)                                    \
            sv_2mortal(cx->blk_eval.old_namesv);                        \
index 975d67e..e821972 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1672,7 +1672,7 @@ PP(pp_caller)
        PUSHs(boolSV((gimme & G_WANT) == G_ARRAY));
     if (CxTYPE(cx) == CXt_EVAL) {
        /* eval STRING */
-       if (cx->blk_eval.old_op_type == OP_ENTEREVAL) {
+       if (CxOLD_OP_TYPE(cx) == OP_ENTEREVAL) {
            PUSHs(cx->blk_eval.cur_text);
            PUSHs(&PL_sv_no);
        }
@@ -2437,7 +2437,7 @@ PP(pp_goto)
            else {
                AV* const padlist = CvPADLIST(cv);
                if (CxTYPE(cx) == CXt_EVAL) {
-                   PL_in_eval = cx->blk_eval.old_in_eval;
+                   PL_in_eval = CxOLD_IN_EVAL(cx);
                    PL_eval_root = cx->blk_eval.old_eval_root;
                    cx->cx_type = CXt_SUB;
                }
diff --git a/scope.c b/scope.c
index c2722f9..4ee0f10 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -1070,10 +1070,10 @@ Perl_cx_dump(pTHX_ PERL_CONTEXT *cx)
        break;
     case CXt_EVAL:
        PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_IN_EVAL = %ld\n",
-               (long)cx->blk_eval.old_in_eval);
+               (long)CxOLD_IN_EVAL(cx));
        PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_OP_TYPE = %s (%s)\n",
-               PL_op_name[cx->blk_eval.old_op_type],
-               PL_op_desc[cx->blk_eval.old_op_type]);
+               PL_op_name[CxOLD_OP_TYPE(cx)],
+               PL_op_desc[CxOLD_OP_TYPE(cx)]);
        if (cx->blk_eval.old_namesv)
            PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_NAME = %s\n",
                          SvPVX_const(cx->blk_eval.old_namesv));