diff options
-rw-r--r-- | Mwrap.xs | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -344,18 +344,20 @@ update_stats_rcu_lock(size_t *generation, size_t size, uintptr_t caller) struct src_loc *k, *ret = 0; static const size_t xlen = sizeof(caller); char *dst; - const COP *cop; + const COP *cop = NULL; struct cds_lfht *t = CMM_LOAD_SHARED(totals); if (caa_unlikely(!t)) return 0; if (locating++) goto out; /* do not recurse into another *alloc */ *generation = uatomic_add_return(&total_bytes_inc, size); + if (&PL_thr_key) { /* are we even in a Perl process? */ #ifdef PERL_IMPLICIT_CONTEXT - cop = aTHX ? PL_curcop : 0; + if (aTHX) cop = PL_curcop; #else - cop = &locating == root_locating ? PL_curcop : 0; + if (&locating == root_locating) cop = PL_curcop; #endif + } rcu_read_lock(); if (cop) { const char *ptr = OutCopFILE(cop); |