On debugging builds, when freeing an op, set its op_ppaddr to point to
a function which dies. That way if a freed op accidentally remains in the
execution path, you'll know immediately, rather than crashing sometime
later with a stack underflow or whatever.
# define PerlMemShared PerlMem
#endif
+/* make freed ops die if they're inadvertently executed */
+#ifdef DEBUGGING
+static OP *
+S_pp_freed(pTHX)
+{
+ DIE(aTHX_ "panic: freed op 0x%p called\n", PL_op);
+}
+#endif
+
void
Perl_Slab_Free(pTHX_ void *op)
{
PERL_ARGS_ASSERT_SLAB_FREE;
+#ifdef DEBUGGING
+ o->op_ppaddr = S_pp_freed;
+#endif
+
if (!o->op_slabbed) {
if (!o->op_static)
PerlMemShared_free(op);