diff options
-rw-r--r-- | cop.h | 25 | ||||
-rw-r--r-- | pp_ctl.c | 16 | ||||
-rw-r--r-- | pp_hot.c | 4 | ||||
-rw-r--r-- | scope.c | 6 | ||||
-rw-r--r-- | sv.c | 8 |
5 files changed, 25 insertions, 34 deletions
@@ -268,22 +268,12 @@ struct block_sub { AV * savearray; AV * argarray; I32 olddepth; - /* These are merged to to get struct context down to 64 bytes on ILP32. */ - U8 hasargs_lval; + U8 hasargs; + U8 lval; /* XXX merge lval and hasargs? */ PAD *oldcomppad; OP * retop; /* op to execute on exit from sub */ }; -#define CX_SUB_HASARGS_SET(cx, v) ((cx)->blk_sub.hasargs_lval = \ - ((cx)->blk_sub.hasargs_lval & 0xFE) | ((v) ? 1 : 0)) -#define CX_SUB_HASARGS_GET(cx) ((cx)->blk_sub.hasargs_lval & 0x01) - -#define CX_SUB_LVAL_SET(cx, v) ((cx)->blk_sub.hasargs_lval = \ - (((cx)->blk_sub.hasargs_lval & 0x01) | ((v) & (OPpLVAL_INTRO|OPpENTERSUB_INARGS)))) -#define CX_SUB_LVAL(cx) ((cx)->blk_sub.hasargs_lval & 0xFE) -#define CX_SUB_LVAL_INARGS(cx) ((cx)->blk_sub.hasargs_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. */ @@ -291,7 +281,7 @@ struct block_sub { #define PUSHSUB_BASE(cx) \ cx->blk_sub.cv = cv; \ cx->blk_sub.olddepth = CvDEPTH(cv); \ - CX_SUB_HASARGS_SET(cx, hasargs); \ + cx->blk_sub.hasargs = hasargs; \ cx->blk_sub.retop = NULL; \ if (!CvDEPTH(cv)) { \ SvREFCNT_inc_simple_void_NN(cv); \ @@ -302,19 +292,20 @@ struct block_sub { #define PUSHSUB(cx) \ PUSHSUB_BASE(cx) \ - CX_SUB_LVAL_SET(cx, PL_op->op_private) + cx->blk_sub.lval = PL_op->op_private & \ + (OPpLVAL_INTRO|OPpENTERSUB_INARGS); /* variant for use by OP_DBSTATE, where op_private holds hint bits */ #define PUSHSUB_DB(cx) \ PUSHSUB_BASE(cx) \ - CX_SUB_LVAL_SET(cx, 0) + cx->blk_sub.lval = 0; #define PUSHFORMAT(cx) \ cx->blk_sub.cv = cv; \ cx->blk_sub.gv = gv; \ cx->blk_sub.retop = NULL; \ - CX_SUB_HASARGS_SET(cx, 0); \ + cx->blk_sub.hasargs = 0; \ cx->blk_sub.dfoutgv = PL_defoutgv; \ SvREFCNT_inc_void(cx->blk_sub.dfoutgv) @@ -335,7 +326,7 @@ struct block_sub { #define POPSUB(cx,sv) \ STMT_START { \ - if (CX_SUB_HASARGS_GET(cx)) { \ + if (cx->blk_sub.hasargs) { \ POP_SAVEARRAY(); \ /* abandon @_ if it got reified */ \ if (AvREAL(cx->blk_sub.argarray)) { \ @@ -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 (CX_SUB_LVAL(cxstack + cxix) && CvLVALUE(cxstack[cxix].blk_sub.cv)) - return CX_SUB_LVAL(cxstack + cxix); + if (cxstack[cxix].blk_sub.lval && CvLVALUE(cxstack[cxix].blk_sub.cv)) + return cxstack[cxix].blk_sub.lval; else return 0; } @@ -1641,11 +1641,11 @@ PP(pp_caller) SV * const sv = newSV(0); gv_efullname3(sv, cvgv, NULL); PUSHs(sv_2mortal(sv)); - PUSHs(sv_2mortal(newSViv((I32)CX_SUB_HASARGS_GET(cx)))); + PUSHs(sv_2mortal(newSViv((I32)cx->blk_sub.hasargs))); } else { PUSHs(sv_2mortal(newSVpvs("(unknown)"))); - PUSHs(sv_2mortal(newSViv((I32)CX_SUB_HASARGS_GET(cx)))); + PUSHs(sv_2mortal(newSViv((I32)cx->blk_sub.hasargs))); } } else { @@ -1678,7 +1678,7 @@ PP(pp_caller) PUSHs(&PL_sv_undef); PUSHs(&PL_sv_undef); } - if (CxTYPE(cx) == CXt_SUB && CX_SUB_HASARGS_GET(cx) + if (CxTYPE(cx) == CXt_SUB && cx->blk_sub.hasargs && CopSTASH_eq(PL_curcop, PL_debstash)) { AV * const ary = cx->blk_sub.argarray; @@ -2348,7 +2348,7 @@ PP(pp_goto) } else if (CxMULTICALL(cx)) DIE(aTHX_ "Can't goto subroutine from a sort sub (or similar callback)"); - if (CxTYPE(cx) == CXt_SUB && CX_SUB_HASARGS_GET(cx)) { + if (CxTYPE(cx) == CXt_SUB && cx->blk_sub.hasargs) { /* put @_ back onto stack */ AV* av = cx->blk_sub.argarray; @@ -2410,7 +2410,7 @@ PP(pp_goto) PL_in_eval = cx->blk_eval.old_in_eval; PL_eval_root = cx->blk_eval.old_eval_root; cx->cx_type = CXt_SUB; - CX_SUB_HASARGS_SET(cx, 0); + cx->blk_sub.hasargs = 0; } cx->blk_sub.cv = cv; cx->blk_sub.olddepth = CvDEPTH(cv); @@ -2425,7 +2425,7 @@ PP(pp_goto) } SAVECOMPPAD(); PAD_SET_CUR_NOSAVE(padlist, CvDEPTH(cv)); - if (CX_SUB_HASARGS_GET(cx)) + if (cx->blk_sub.hasargs) { AV* const av = (AV*)PAD_SVl(0); @@ -2518,7 +2518,7 @@ PP(pp_leavesublv) TAINT_NOT; - if (CX_SUB_LVAL_INARGS(cx)) { + if (cx->blk_sub.lval & OPpENTERSUB_INARGS) { /* 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_SUB_LVAL(cx)) { /* Leave it as it is if we can. */ + else if (cx->blk_sub.lval) { /* 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. */ @@ -1033,7 +1033,7 @@ Perl_cx_dump(pTHX_ PERL_CONTEXT *cx) PerlIO_printf(Perl_debug_log, "BLK_SUB.DFOUTGV = 0x%"UVxf"\n", PTR2UV(cx->blk_sub.dfoutgv)); PerlIO_printf(Perl_debug_log, "BLK_SUB.HASARGS = %d\n", - (int)CX_SUB_HASARGS_GET(cx)); + (int)cx->blk_sub.hasargs); PerlIO_printf(Perl_debug_log, "BLK_SUB.RETOP = 0x%"UVxf"\n", PTR2UV(cx->blk_sub.retop)); break; @@ -1043,9 +1043,9 @@ Perl_cx_dump(pTHX_ PERL_CONTEXT *cx) PerlIO_printf(Perl_debug_log, "BLK_SUB.OLDDEPTH = %ld\n", (long)cx->blk_sub.olddepth); PerlIO_printf(Perl_debug_log, "BLK_SUB.HASARGS = %d\n", - (int)CX_SUB_HASARGS_GET(cx)); + (int)cx->blk_sub.hasargs); PerlIO_printf(Perl_debug_log, "BLK_SUB.LVAL = %d\n", - (int)CX_SUB_LVAL(cx)); + (int)cx->blk_sub.lval); PerlIO_printf(Perl_debug_log, "BLK_SUB.RETOP = 0x%"UVxf"\n", PTR2UV(cx->blk_sub.retop)); break; @@ -10287,13 +10287,13 @@ Perl_cx_dup(pTHX_ PERL_CONTEXT *cxs, I32 ix, I32 max, CLONE_PARAMS* param) ncx->blk_sub.cv = (cx->blk_sub.olddepth == 0 ? cv_dup_inc(cx->blk_sub.cv, param) : cv_dup(cx->blk_sub.cv,param)); - ncx->blk_sub.argarray = (CX_SUB_HASARGS_GET(cx) + ncx->blk_sub.argarray = (cx->blk_sub.hasargs ? av_dup_inc(cx->blk_sub.argarray, param) : NULL); 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)); - CX_SUB_LVAL_SET(ncx, CX_SUB_LVAL(cx)); + ncx->blk_sub.hasargs = cx->blk_sub.hasargs; + ncx->blk_sub.lval = cx->blk_sub.lval; ncx->blk_sub.retop = cx->blk_sub.retop; ncx->blk_sub.oldcomppad = (PAD*)ptr_table_fetch(PL_ptr_table, cx->blk_sub.oldcomppad); @@ -10328,7 +10328,7 @@ Perl_cx_dup(pTHX_ PERL_CONTEXT *cxs, I32 ix, I32 max, CLONE_PARAMS* param) ncx->blk_sub.cv = cv_dup(cx->blk_sub.cv, param); ncx->blk_sub.gv = gv_dup(cx->blk_sub.gv, param); ncx->blk_sub.dfoutgv = gv_dup_inc(cx->blk_sub.dfoutgv, param); - CX_SUB_HASARGS_SET(ncx, CX_SUB_HASARGS_GET(cx)); + ncx->blk_sub.hasargs = cx->blk_sub.hasargs; ncx->blk_sub.retop = cx->blk_sub.retop; break; case CXt_BLOCK: |