summaryrefslogtreecommitdiff
path: root/proto.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-12-05 12:53:30 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-12-05 21:31:42 -0800
commit230834321e308444d408bdbf755d181b67e82d4c (patch)
tree0775daf798c8ecb31604e073e21eeba3a65b9375 /proto.h
parentbcea25a760263ce058f5588c6ae62af6f09a211e (diff)
downloadperl-230834321e308444d408bdbf755d181b67e82d4c.tar.gz
Stop renamed packages from making reset() crash
This only affected threaded builds. I think the comments in the added test explain well enough what was happening. The solution is to store a stashpad offset in the pmop, instead of the name of the stash. This is similar to what was done with cop stashes in d4d03940c58a. Not only does this fix the crash, but it also makes compilation faster and saves memory (no separate malloc for every m?pat?). I had to move Safefree(PL_stashpad) later on in perl_destruct, because freeing a pmop causes the PL_stashpad to be accessed, and pmops can be freed during sv_clean_all. Its previous location was not a problem for cops, as PL_stashpad[cop->cop_stashoff] is only accessed when PL_curcop==that_cop and Perl code is running, not when cops are freed.
Diffstat (limited to 'proto.h')
-rw-r--r--proto.h21
1 files changed, 5 insertions, 16 deletions
diff --git a/proto.h b/proto.h
index 0f19ccd8e8..2351b32418 100644
--- a/proto.h
+++ b/proto.h
@@ -4846,15 +4846,6 @@ PERL_CALLCONV void Perl_utilize(pTHX_ int aver, I32 floor, OP* version, OP* idop
assert(idop)
#endif
-#if !(defined(USE_ITHREADS))
-# if defined(PERL_IN_OP_C)
-STATIC void S_forget_pmop(pTHX_ PMOP *const o)
- __attribute__nonnull__(pTHX_1);
-#define PERL_ARGS_ASSERT_FORGET_PMOP \
- assert(o)
-
-# endif
-#endif
#if !defined(HAS_BZERO) && !defined(HAS_MEMSET)
PERL_CALLCONV char* Perl_my_bzero(char* loc, I32 len)
__attribute__nonnull__(1);
@@ -5769,6 +5760,11 @@ STATIC OP* S_fold_constants(pTHX_ OP *o)
assert(o)
STATIC OP* S_force_list(pTHX_ OP* arg);
+STATIC void S_forget_pmop(pTHX_ PMOP *const o)
+ __attribute__nonnull__(pTHX_1);
+#define PERL_ARGS_ASSERT_FORGET_PMOP \
+ assert(o)
+
STATIC OP* S_gen_constant_list(pTHX_ OP* o);
STATIC SV* S_gv_ename(pTHX_ GV *gv)
__attribute__nonnull__(pTHX_1);
@@ -5901,13 +5897,6 @@ STATIC OP* S_too_many_arguments_sv(pTHX_ OP *o, SV* namesv, U32 flags)
#define PERL_ARGS_ASSERT_TOO_MANY_ARGUMENTS_SV \
assert(o); assert(namesv)
-# if defined(USE_ITHREADS)
-STATIC void S_forget_pmop(pTHX_ PMOP *const o, U32 flags)
- __attribute__nonnull__(pTHX_1);
-#define PERL_ARGS_ASSERT_FORGET_PMOP \
- assert(o)
-
-# endif
#endif
#if defined(PERL_IN_OP_C) || defined(PERL_IN_SV_C)
PERL_CALLCONV void Perl_report_redefined_cv(pTHX_ const SV *name, const CV *old_cv, SV * const *new_const_svp)