X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=cop.h;h=e8221b610c3fefdee548ba3b3e4f6dc2dd0e5161;hb=cc50ac46d6f5968c34044ce7c501b06af15fc51a;hp=f23251b5433a85f22409a0a222159ad6a0da6b77;hpb=a7c6d24429ab2b6db54575a3bdc62c7ed9f881cf;p=p5sagit%2Fp5-mst-13.2.git diff --git a/cop.h b/cop.h index f23251b..e8221b6 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)) \