From: Nicholas Clark Date: Wed, 4 Apr 2007 17:22:02 +0000 (+0000) Subject: Get further through the build with read-only optrees. Free()ing cops X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3235b7a3ce519fbc8f77ac78f561cb023f680d6d;p=p5sagit%2Fp5-mst-13.2.git Get further through the build with read-only optrees. Free()ing cops as currently implemented seems to want write activity to them. Also we save a field in PL_curcop at one point, and sometimes this can be in a read only COP. If so, the end of scope restoration is always to the same value, but it's easier to cheat and skip the restoration than to dig around and avoid the save. p4raw-id: //depot/perl@30843 --- diff --git a/op.c b/op.c index 537322a..7c7e74f 100644 --- a/op.c +++ b/op.c @@ -449,8 +449,12 @@ Perl_op_free(pTHX_ OP *o) /* COP* is not cleared by op_clear() so that we may track line * numbers etc even after null() */ - if (type == OP_NEXTSTATE || type == OP_SETSTATE || type == OP_DBSTATE) + if (type == OP_NEXTSTATE || type == OP_SETSTATE || type == OP_DBSTATE) { +#ifdef PERL_DEBUG_READONLY_OPS + Slab_to_rw(o); +#endif cop_free((COP*)o); + } op_clear(o); if (o->op_latefree) { diff --git a/scope.c b/scope.c index 6bd77da..d52d12d 100644 --- a/scope.c +++ b/scope.c @@ -707,7 +707,15 @@ Perl_leave_scope(pTHX_ I32 base) break; case SAVEt_I32: /* I32 reference */ ptr = SSPOPPTR; +#ifdef PERL_DEBUG_READONLY_OPS + { + const I32 val = SSPOPINT; + if (*(I32*)ptr != val) + *(I32*)ptr = val; + } +#else *(I32*)ptr = (I32)SSPOPINT; +#endif break; case SAVEt_SPTR: /* SV* reference */ ptr = SSPOPPTR;