X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=cop.h;h=1fdd6d1845d527a17bd5ac18d649c4c277f4570b;hb=98eae8f585b9800849b5e5482e2d405f21bab67e;hp=84afd58967d0115446665a5f03dfbef171f9a486;hpb=864dbfa3ca8032ef66f7aa86961933b19b962357;p=p5sagit%2Fp5-mst-13.2.git diff --git a/cop.h b/cop.h index 84afd58..1fdd6d1 100644 --- a/cop.h +++ b/cop.h @@ -35,12 +35,15 @@ struct block_sub { AV * argarray; U16 olddepth; U8 hasargs; + U8 lval; /* XXX merge lval and hasargs? */ }; #define PUSHSUB(cx) \ cx->blk_sub.cv = cv; \ cx->blk_sub.olddepth = CvDEPTH(cv); \ - cx->blk_sub.hasargs = hasargs; + cx->blk_sub.hasargs = hasargs; \ + cx->blk_sub.lval = PL_op->op_private & \ + (OPpLVAL_INTRO|OPpENTERSUB_INARGS); #define PUSHFORMAT(cx) \ cx->blk_sub.cv = cv; \ @@ -63,16 +66,22 @@ struct block_sub { #define POPSAVEARRAY() \ STMT_START { \ SvREFCNT_dec(GvAV(PL_defgv)); \ - GvAV(PL_defgv) = cxsub.savearray; \ + GvAV(PL_defgv) = cxsub.savearray; \ } STMT_END #endif /* USE_THREADS */ #define POPSUB2() \ if (cxsub.hasargs) { \ POPSAVEARRAY(); \ - /* destroy arg array */ \ - av_clear(cxsub.argarray); \ - AvREAL_off(cxsub.argarray); \ + /* abandon @_ if it got reified */ \ + if (AvREAL(cxsub.argarray)) { \ + SSize_t fill = AvFILLp(cxsub.argarray); \ + SvREFCNT_dec(cxsub.argarray); \ + cxsub.argarray = newAV(); \ + av_extend(cxsub.argarray, fill); \ + AvFLAGS(cxsub.argarray) = AVf_REIFY; \ + PL_curpad[0] = (SV*)cxsub.argarray; \ + } \ } \ if (cxsub.cv) { \ if (!(CvDEPTH(cxsub.cv) = cxsub.olddepth)) \ @@ -120,8 +129,8 @@ struct block_loop { }; #define PUSHLOOP(cx, ivar, s) \ - cx->blk_loop.label = PL_curcop->cop_label; \ - cx->blk_loop.resetsp = s - PL_stack_base; \ + 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; \ @@ -186,7 +195,7 @@ struct block { cx->blk_oldretsp = PL_retstack_ix, \ cx->blk_oldpm = PL_curpm, \ cx->blk_gimme = gimme; \ - DEBUG_l( PerlIO_printf(PerlIO_stderr(), "Entering block %ld, type %s\n", \ + DEBUG_l( PerlIO_printf(Perl_debug_log, "Entering block %ld, type %s\n", \ (long)cxstack_ix, PL_block_type[CxTYPE(cx)]); ) /* Exit a block (RETURN and LAST). */ @@ -198,7 +207,7 @@ struct block { PL_retstack_ix = cx->blk_oldretsp, \ pm = cx->blk_oldpm, \ gimme = cx->blk_gimme; \ - DEBUG_l( PerlIO_printf(PerlIO_stderr(), "Leaving block %ld, type %s\n", \ + DEBUG_l( PerlIO_printf(Perl_debug_log, "Leaving block %ld, type %s\n", \ (long)cxstack_ix+1,PL_block_type[CxTYPE(cx)]); ) /* Continue a block elsewhere (NEXT and REDO). */ @@ -297,6 +306,7 @@ struct context { #define G_NOARGS 8 /* Don't construct a @_ array. */ #define G_KEEPERR 16 /* Append errors to $@, don't overwrite it */ #define G_NODEBUG 32 /* Disable debugging at toplevel. */ +#define G_NOCATCH 64 /* Don't do CATCH_SET() */ /* flag bits for PL_in_eval */ #define EVAL_NULL 0 /* not in an eval */ @@ -370,7 +380,7 @@ typedef struct stackinfo PERL_SI; djSP; \ PERL_SI *prev = PL_curstackinfo->si_prev; \ if (!prev) { \ - PerlIO_printf(PerlIO_stderr(), "panic: POPSTACK\n"); \ + PerlIO_printf(Perl_error_log, "panic: POPSTACK\n"); \ my_exit(1); \ } \ SWITCHSTACK(PL_curstack,prev->si_stack); \