eliminate next_op from struct block_loop
authorDavid Mitchell <davem@iabyn.com>
Wed, 8 Sep 2010 11:11:41 +0000 (12:11 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 8 Sep 2010 13:48:29 +0000 (14:48 +0100)
This field is only used in non-threaded builds, and the comments imply
that this is because in non-threaded builds this value may be
modified. But nothing in core modifies it.

cop.h
pp_ctl.c
scope.c

diff --git a/cop.h b/cop.h
index 8139d48..e6b9bcb 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -447,14 +447,11 @@ struct block_eval {
 struct block_loop {
     I32                resetsp;
     LOOP *     my_op;  /* My op, that contains redo, next and last ops.  */
-    /* (except for non_ithreads we need to modify next_op in pp_ctl.c, hence
-       why next_op is conditionally defined below.)  */
 #ifdef USE_ITHREADS
     PAD                *oldcomppad; /* Also used for the GV, if targoffset is 0 */
     /* This is also accesible via cx->blk_loop.my_op->op_targ */
     PADOFFSET  targoffset;
 #else
-    OP *       next_op;
     SV **      itervar;
 #endif
     union {
@@ -494,18 +491,9 @@ struct block_loop {
 #define CxHASARGS(c)   (((c)->cx_type & CXp_HASARGS) == CXp_HASARGS)
 #define CxLVAL(c)      (0 + (c)->blk_u16)
 
-#ifdef USE_ITHREADS
-#  define PUSHLOOP_OP_NEXT             /* No need to do anything.  */
-#  define CX_LOOP_NEXTOP_GET(cx)       ((cx)->blk_loop.my_op->op_nextop + 0)
-#else
-#  define PUSHLOOP_OP_NEXT             cx->blk_loop.next_op = cLOOP->op_nextop
-#  define CX_LOOP_NEXTOP_GET(cx)       ((cx)->blk_loop.next_op + 0)
-#endif
-
 #define PUSHLOOP_PLAIN(cx, s)                                          \
        cx->blk_loop.resetsp = s - PL_stack_base;                       \
        cx->blk_loop.my_op = cLOOP;                                     \
-       PUSHLOOP_OP_NEXT;                                               \
        cx->blk_loop.state_u.ary.ary = NULL;                            \
        cx->blk_loop.state_u.ary.ix = 0;                                \
        CX_ITERDATA_SET(cx, NULL, 0);
@@ -513,7 +501,6 @@ struct block_loop {
 #define PUSHLOOP_FOR(cx, dat, s, offset)                               \
        cx->blk_loop.resetsp = s - PL_stack_base;                       \
        cx->blk_loop.my_op = cLOOP;                                     \
-       PUSHLOOP_OP_NEXT;                                               \
        cx->blk_loop.state_u.ary.ary = NULL;                            \
        cx->blk_loop.state_u.ary.ix = 0;                                \
        CX_ITERDATA_SET(cx, dat, offset);
index 3fd46ba..93d1675 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2381,7 +2381,7 @@ PP(pp_next)
     if (PL_scopestack_ix < inner)
        leave_scope(PL_scopestack[PL_scopestack_ix]);
     PL_curcop = cx->blk_oldcop;
-    return CX_LOOP_NEXTOP_GET(cx);
+    return (cx)->blk_loop.my_op->op_nextop;
 }
 
 PP(pp_redo)
@@ -4769,7 +4769,7 @@ PP(pp_break)
     PL_curcop = cx->blk_oldcop;
 
     if (CxFOREACH(cx))
-       return CX_LOOP_NEXTOP_GET(cx);
+       return (cx)->blk_loop.my_op->op_nextop;
     else
        /* RETURNOP calls PUTBACK which restores the old old sp */
        RETURNOP(cx->blk_givwhen.leave_op);
diff --git a/scope.c b/scope.c
index 5445da9..93ef4b3 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -1232,8 +1232,6 @@ Perl_cx_dump(pTHX_ PERL_CONTEXT *cx)
                (long)cx->blk_loop.resetsp);
        PerlIO_printf(Perl_debug_log, "BLK_LOOP.MY_OP = 0x%"UVxf"\n",
                PTR2UV(cx->blk_loop.my_op));
-       PerlIO_printf(Perl_debug_log, "BLK_LOOP.NEXT_OP = 0x%"UVxf"\n",
-               PTR2UV(CX_LOOP_NEXTOP_GET(cx)));
        /* XXX: not accurate for LAZYSV/IV */
        PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERARY = 0x%"UVxf"\n",
                PTR2UV(cx->blk_loop.state_u.ary.ary));