summaryrefslogtreecommitdiff
path: root/cop.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-09-17 00:06:53 +0000
committerNicholas Clark <nick@ccl4.org>2006-09-17 00:06:53 +0000
commit022eaa24f0f108e678e18c854c6eb92c735188c5 (patch)
treef7fa1f84dbfad01af797e9d57590d92ee5396ef7 /cop.h
parent26844e2782d7192ed739172c5303bb52947596dc (diff)
downloadperl-022eaa24f0f108e678e18c854c6eb92c735188c5.tar.gz
Store a pointer to the op in struct block_loop, rather than the
pointers to last and redo. (for ithreads also drop the next pointer, as pp_ctl.c doesn't re-write it for ithreads). This shrinks the struct to 40 bytes on ILP32 systems, and therefore struct block to 64 bytes. p4raw-id: //depot/perl@28858
Diffstat (limited to 'cop.h')
-rw-r--r--cop.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/cop.h b/cop.h
index a630b64a2c..66b7ffb41d 100644
--- a/cop.h
+++ b/cop.h
@@ -393,13 +393,14 @@ struct block_eval {
struct block_loop {
char * label;
I32 resetsp;
- OP * redo_op;
- OP * next_op;
- OP * last_op;
+ 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
void * iterdata;
PAD *oldcomppad;
#else
+ OP * next_op;
SV ** itervar;
#endif
SV * itersave;
@@ -432,12 +433,19 @@ struct block_loop {
cx->blk_loop.itersave = NULL;
#endif
+#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(cx, dat, s) \
cx->blk_loop.label = PL_curcop->cop_label; \
cx->blk_loop.resetsp = s - PL_stack_base; \
- cx->blk_loop.redo_op = cLOOP->op_redoop; \
- cx->blk_loop.next_op = cLOOP->op_nextop; \
- cx->blk_loop.last_op = cLOOP->op_lastop; \
+ cx->blk_loop.my_op = cLOOP; \
+ PUSHLOOP_OP_NEXT; \
cx->blk_loop.iterlval = NULL; \
cx->blk_loop.iterary = NULL; \
cx->blk_loop.iterix = -1; \