X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=op.c;h=991a42661cf7cfb1de12d72117f41a9576a904fd;hb=773b30b9d40ef0a7f9346541b7eabb9a1a82fef1;hp=1366976c1f3fb324c170c411128cd98f31666750;hpb=8ec8fbef8c5eb2490dc99115adb2487f3bf9ddab;p=p5sagit%2Fp5-mst-13.2.git diff --git a/op.c b/op.c index 1366976..991a426 100644 --- a/op.c +++ b/op.c @@ -30,13 +30,8 @@ #define PERL_SLAB_SIZE 2048 #endif -#define NewOp(m,var,c,type) \ - STMT_START { var = (type *) Slab_Alloc(m,c*sizeof(type)); } STMT_END - -#define FreeOp(p) Slab_Free(p) - -STATIC void * -S_Slab_Alloc(pTHX_ int m, size_t sz) +void * +Perl_Slab_Alloc(pTHX_ int m, size_t sz) { /* * To make incrementing use count easy PL_OpSlab is an I32 * @@ -74,8 +69,8 @@ S_Slab_Alloc(pTHX_ int m, size_t sz) return (void *)(PL_OpPtr + 1); } -STATIC void -S_Slab_Free(pTHX_ void *op) +void +Perl_Slab_Free(pTHX_ void *op) { I32 **ptr = (I32 **) op; I32 *slab = ptr[-1]; @@ -93,10 +88,6 @@ S_Slab_Free(pTHX_ void *op) } } } - -#else -#define NewOp(m, var, c, type) Newz(m, var, c, type) -#define FreeOp(p) Safefree(p) #endif /* * In the following definition, the ", Nullop" is just to make the compiler @@ -3751,7 +3742,7 @@ Perl_newFOROP(pTHX_ I32 flags,char *label,line_t forline,OP *sv,OP *expr,OP *blo append_elem(OP_LIST, expr, scalar(sv)))); assert(!loop->op_next); /* for my $x () sets OPpLVAL_INTRO; - * for our $x () sets OPpOUR_INTRO; both only used by Deparse.pm */ + * for our $x () sets OPpOUR_INTRO */ loop->op_private = (U8)iterpflags; #ifdef PL_OP_SLAB_ALLOC { @@ -3796,6 +3787,8 @@ Perl_newLOOPEX(pTHX_ I32 type, OP *label) return o; } +static void const_sv_xsub(pTHX_ CV* cv); + /* =for apidoc cv_undef @@ -3811,8 +3804,9 @@ void Perl_cv_undef(pTHX_ CV *cv) { #ifdef USE_ITHREADS - if (CvFILE(cv) && !CvXSUB(cv)) { - /* for XSUBs CvFILE point directly to static memory; __FILE__ */ + if (CvFILE(cv) && (!CvXSUB(cv) || CvXSUB(cv) == const_sv_xsub)) { + /* for XSUBs CvFILE point directly to static memory; __FILE__ + * except when XSUB was constructed via newCONSTSUB() */ Safefree(CvFILE(cv)); } CvFILE(cv) = 0; @@ -3874,8 +3868,6 @@ Perl_cv_ckproto(pTHX_ CV *cv, GV *gv, char *p) } } -static void const_sv_xsub(pTHX_ CV* cv); - /* =head1 Optree Manipulation Functions @@ -4359,6 +4351,9 @@ Perl_newCONSTSUB(pTHX_ HV *stash, char *name, SV *sv) CvCONST_on(cv); sv_setpv((SV*)cv, ""); /* prototype is "" */ + if (stash) + CopSTASH_free(PL_curcop); + LEAVE; return cv; @@ -4686,9 +4681,10 @@ Perl_ck_bitop(pTHX_ OP *o) (op) == OP_NE || (op) == OP_I_NE || \ (op) == OP_NCMP || (op) == OP_I_NCMP) o->op_private = (U8)(PL_hints & HINT_PRIVATE_MASK); - if (o->op_type == OP_BIT_OR - || o->op_type == OP_BIT_AND - || o->op_type == OP_BIT_XOR) + if (!(o->op_flags & OPf_STACKED) /* Not an assignment */ + && (o->op_type == OP_BIT_OR + || o->op_type == OP_BIT_AND + || o->op_type == OP_BIT_XOR)) { OP * left = cBINOPo->op_first; OP * right = left->op_sibling; @@ -5306,7 +5302,7 @@ Perl_ck_glob(pTHX_ OP *o) #if !defined(PERL_EXTERNAL_GLOB) /* XXX this can be tightened up and made more failsafe. */ - if (!gv) { + if (!(gv && GvCVu(gv) && GvIMPORTED_CV(gv))) { GV *glob_gv; ENTER; Perl_load_module(aTHX_ PERL_LOADMOD_NOIMPORT,