From: Nicholas Clark Date: Wed, 12 Apr 2006 12:01:38 +0000 (+0000) Subject: As OPs are shared between threads, they should be using X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=04e62e517a756f965d577afe246e77a841330712;p=p5sagit%2Fp5-mst-13.2.git As OPs are shared between threads, they should be using PerlMemShared_*alloc functions, rather than per-thread *alloc()s. p4raw-id: //depot/perl@27773 --- diff --git a/op.c b/op.c index 64dc9f2..da99916 100644 --- a/op.c +++ b/op.c @@ -4539,7 +4539,7 @@ Perl_newFOROP(pTHX_ I32 flags, char *label, line_t forline, OP *sv, OP *expr, OP loop = tmp; } #else - Renew(loop, 1, LOOP); + loop = PerlMemShared_realloc(loop, sizeof(LOOP)); #endif loop->op_targ = padoff; wop = newWHILEOP(flags, 1, loop, forline, newOP(OP_ITER, 0), block, cont, 0); diff --git a/op.h b/op.h index e38c578..7ae65d7 100644 --- a/op.h +++ b/op.h @@ -551,10 +551,12 @@ struct loop { (var = (OP *) Perl_Slab_Alloc(aTHX_ m,size)) #define FreeOp(p) Perl_Slab_Free(aTHX_ p) #else -#define NewOp(m, var, c, type) Newxz(var, c, type) +#define NewOp(m, var, c, type) \ + (var = (MEM_WRAP_CHECK_(c,type) \ + (type*)PerlMemShared_calloc(c, sizeof(type)))) #define NewOpSz(m, var, size) \ - (var = (OP*)safemalloc(size), memzero(var, size)) -#define FreeOp(p) Safefree(p) + (var = (OP*)PerlMemShared_calloc(1, size)) +#define FreeOp(p) PerlMemShared_free(p) #endif #ifdef PERL_MAD