From: Nicholas Clark Date: Fri, 1 Sep 2006 16:27:48 +0000 (+0000) Subject: Access to cx->blk_sub.lval via macros (as it's about to move). X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1c75a43bf7257081c0bfa53f793afc33ee95ff02;p=p5sagit%2Fp5-mst-13.2.git Access to cx->blk_sub.lval via macros (as it's about to move). p4raw-id: //depot/perl@28773 --- diff --git a/cop.h b/cop.h index c248eed..df07aa6 100644 --- a/cop.h +++ b/cop.h @@ -274,13 +274,19 @@ struct block_sub { OP * retop; /* op to execute on exit from sub */ }; +#define CX_SUB_HASARGS_SET(cx, v) ((cx)->blk_sub.hasargs = (v)) +#define CX_SUB_HASARGS_GET(cx) ((cx)->blk_sub.hasargs + 0) + +#define CX_SUB_LVAL_SET(cx, v) ((cx)->blk_sub.lval = (v) & \ + (OPpLVAL_INTRO|OPpENTERSUB_INARGS)) +#define CX_SUB_LVAL(cx) ((cx)->blk_sub.lval + 0) +#define CX_SUB_LVAL_INARGS(cx) ((cx)->blk_sub.lval & \ + OPpENTERSUB_INARGS) + /* base for the next two macros. Don't use directly. * Note that the refcnt of the cv is incremented twice; The CX one is * decremented by LEAVESUB, the other by LEAVE. */ -#define CX_SUB_HASARGS_SET(cx, v) ((cx)->blk_sub.hasargs = (v)) -#define CX_SUB_HASARGS_GET(cx) ((cx)->blk_sub.hasargs + 0) - #define PUSHSUB_BASE(cx) \ cx->blk_sub.cv = cv; \ cx->blk_sub.olddepth = CvDEPTH(cv); \ @@ -295,13 +301,12 @@ struct block_sub { #define PUSHSUB(cx) \ PUSHSUB_BASE(cx) \ - cx->blk_sub.lval = PL_op->op_private & \ - (OPpLVAL_INTRO|OPpENTERSUB_INARGS); + CX_SUB_LVAL_SET(cx, PL_op->op_private) /* variant for use by OP_DBSTATE, where op_private holds hint bits */ #define PUSHSUB_DB(cx) \ PUSHSUB_BASE(cx) \ - cx->blk_sub.lval = 0; + CX_SUB_LVAL_SET(cx, 0) #define PUSHFORMAT(cx) \ diff --git a/pp_ctl.c b/pp_ctl.c index 5efbdc5..4a1c634 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -1289,8 +1289,8 @@ Perl_is_lvalue_sub(pTHX) const I32 cxix = dopoptosub(cxstack_ix); assert(cxix >= 0); /* We should only be called from inside subs */ - if (cxstack[cxix].blk_sub.lval && CvLVALUE(cxstack[cxix].blk_sub.cv)) - return cxstack[cxix].blk_sub.lval; + if (CX_SUB_LVAL(cxstack + cxix) && CvLVALUE(cxstack[cxix].blk_sub.cv)) + return CX_SUB_LVAL(cxstack + cxix); else return 0; } diff --git a/pp_hot.c b/pp_hot.c index 32274ff..cbb35a3 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -2518,7 +2518,7 @@ PP(pp_leavesublv) TAINT_NOT; - if (cx->blk_sub.lval & OPpENTERSUB_INARGS) { + if (CX_SUB_LVAL_INARGS(cx)) { /* We are an argument to a function or grep(). * This kind of lvalueness was legal before lvalue * subroutines too, so be backward compatible: @@ -2545,7 +2545,7 @@ PP(pp_leavesublv) } } } - else if (cx->blk_sub.lval) { /* Leave it as it is if we can. */ + else if (CX_SUB_LVAL(cx)) { /* Leave it as it is if we can. */ /* Here we go for robustness, not for speed, so we change all * the refcounts so the caller gets a live guy. Cannot set * TEMP, so sv_2mortal is out of question. */ diff --git a/scope.c b/scope.c index 9bb2b57..6365f2d 100644 --- a/scope.c +++ b/scope.c @@ -1045,7 +1045,7 @@ Perl_cx_dump(pTHX_ PERL_CONTEXT *cx) PerlIO_printf(Perl_debug_log, "BLK_SUB.HASARGS = %d\n", (int)CX_SUB_HASARGS_GET(cx)); PerlIO_printf(Perl_debug_log, "BLK_SUB.LVAL = %d\n", - (int)cx->blk_sub.lval); + (int)CX_SUB_LVAL(cx)); PerlIO_printf(Perl_debug_log, "BLK_SUB.RETOP = 0x%"UVxf"\n", PTR2UV(cx->blk_sub.retop)); break; diff --git a/sv.c b/sv.c index 56d292e..93b6d58 100644 --- a/sv.c +++ b/sv.c @@ -10292,7 +10292,7 @@ Perl_cx_dup(pTHX_ PERL_CONTEXT *cxs, I32 ix, I32 max, CLONE_PARAMS* param) ncx->blk_sub.savearray = av_dup_inc(cx->blk_sub.savearray, param); ncx->blk_sub.olddepth = cx->blk_sub.olddepth; CX_SUB_HASARGS_SET(ncx, CX_SUB_HASARGS_GET(cx)); - ncx->blk_sub.lval = cx->blk_sub.lval; + CX_SUB_LVAL_SET(ncx, CX_SUB_LVAL(cx)); ncx->blk_sub.retop = cx->blk_sub.retop; ncx->blk_sub.oldcomppad = (PAD*)ptr_table_fetch(PL_ptr_table, cx->blk_sub.oldcomppad);