It causes pp_entersub to be called in odd places, which can cause the
context stack to be reallocated when an outer function call (like
pp_leavesub) has a pointer into the context stack in a C auto.
cleanup.t was failing for me under PERL_DEBUG_READONLY_COW +
STRESS_REALLOC + threads, because the context stack was reallocated
and the old address then freed and reused for something else, being
zeroed in the mean time. So pp_leavesub returned NULL (trying to
read retop from the context stack), causing the program to exit.
During global destruction, subs that had not be exited properly were
undefined, leading to:
1..3
Can't undef active subroutine during global destruction.
THX_run_cleanup(pTHX_ void *cleanup_code_ref)
{
dSP;
+ PUSHSTACK;
ENTER;
SAVETMPS;
PUSHMARK(SP);
call_sv((SV*)cleanup_code_ref, G_VOID|G_DISCARD);
FREETMPS;
LEAVE;
+ POPSTACK;
}
STATIC OP *