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
/* 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) {
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;