X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=cop.h;h=870225ca5ddee852b7e176ddcfbc8df24950ee38;hb=7e107e90b7bd52c7fb110ac98da6bb7ab38e8959;hp=3b2699e40196cbf882d00aef5c432d7a38345cdb;hpb=083fcd59cab1a76269852c22b8b181ad12d6cfe9;p=p5sagit%2Fp5-mst-13.2.git diff --git a/cop.h b/cop.h index 3b2699e..870225c 100644 --- a/cop.h +++ b/cop.h @@ -5,6 +5,11 @@ * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * + * Control ops (cops) are one of the three ops OP_NEXTSTATE, OP_DBSTATE, + * and OP_SETSTATE that (loosely speaking) separate statements. They hold + * imformation important for lexical state and error reporting. At run + * time, PL_curcop is set to point to the most recently executed cop, + * and thus can be used to determine our current state. */ struct cop { @@ -107,14 +112,12 @@ struct block_sub { CV * cv; GV * gv; GV * dfoutgv; -#ifndef USE_5005THREADS AV * savearray; -#endif /* USE_5005THREADS */ AV * argarray; - U16 olddepth; + long olddepth; U8 hasargs; U8 lval; /* XXX merge lval and hasargs? */ - SV ** oldcurpad; + PAD *oldcomppad; }; #define PUSHSUB(cx) \ @@ -131,15 +134,11 @@ struct block_sub { cx->blk_sub.dfoutgv = PL_defoutgv; \ (void)SvREFCNT_inc(cx->blk_sub.dfoutgv) -#ifdef USE_5005THREADS -# define POP_SAVEARRAY() NOOP -#else -# define POP_SAVEARRAY() \ +#define POP_SAVEARRAY() \ STMT_START { \ SvREFCNT_dec(GvAV(PL_defgv)); \ GvAV(PL_defgv) = cx->blk_sub.savearray; \ } STMT_END -#endif /* USE_5005THREADS */ /* junk in @_ spells trouble when cloning CVs and in pp_caller(), so don't * leave any (a fast av_clear(ary), basically) */ @@ -161,7 +160,7 @@ struct block_sub { cx->blk_sub.argarray = newAV(); \ av_extend(cx->blk_sub.argarray, fill); \ AvFLAGS(cx->blk_sub.argarray) = AVf_REIFY; \ - cx->blk_sub.oldcurpad[0] = (SV*)cx->blk_sub.argarray; \ + CX_CURPAD_SV(cx->blk_sub, 0) = (SV*)cx->blk_sub.argarray; \ } \ else { \ CLEAR_ARGARRAY(cx->blk_sub.argarray); \ @@ -220,7 +219,7 @@ struct block_loop { OP * last_op; #ifdef USE_ITHREADS void * iterdata; - SV ** oldcurpad; + PAD *oldcomppad; #else SV ** itervar; #endif @@ -235,18 +234,23 @@ struct block_loop { # define CxITERVAR(c) \ ((c)->blk_loop.iterdata \ ? (CxPADLOOP(cx) \ - ? &((c)->blk_loop.oldcurpad)[INT2PTR(PADOFFSET, (c)->blk_loop.iterdata)] \ + ? &CX_CURPAD_SV( (c)->blk_loop, \ + INT2PTR(PADOFFSET, (c)->blk_loop.iterdata)) \ : &GvSV((GV*)(c)->blk_loop.iterdata)) \ : (SV**)NULL) # define CX_ITERDATA_SET(cx,idata) \ - cx->blk_loop.oldcurpad = PL_curpad; \ + CX_CURPAD_SAVE(cx->blk_loop); \ if ((cx->blk_loop.iterdata = (idata))) \ - cx->blk_loop.itersave = SvREFCNT_inc(*CxITERVAR(cx)); + cx->blk_loop.itersave = SvREFCNT_inc(*CxITERVAR(cx)); \ + else \ + cx->blk_loop.itersave = Nullsv; #else # define CxITERVAR(c) ((c)->blk_loop.itervar) # define CX_ITERDATA_SET(cx,ivar) \ if ((cx->blk_loop.itervar = (SV**)(ivar))) \ - cx->blk_loop.itersave = SvREFCNT_inc(*CxITERVAR(cx)); + cx->blk_loop.itersave = SvREFCNT_inc(*CxITERVAR(cx)); \ + else \ + cx->blk_loop.itersave = Nullsv; #endif #define PUSHLOOP(cx, dat, s) \ @@ -306,7 +310,7 @@ struct block { cx->blk_oldscopesp = PL_scopestack_ix, \ cx->blk_oldretsp = PL_retstack_ix, \ cx->blk_oldpm = PL_curpm, \ - cx->blk_gimme = gimme; \ + cx->blk_gimme = (U8)gimme; \ DEBUG_l( PerlIO_printf(Perl_debug_log, "Entering block %ld, type %s\n", \ (long)cxstack_ix, PL_block_type[CxTYPE(cx)]); )