summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-07-05 22:51:50 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-08-09 19:44:13 -0700
commit1dc74fdba201402174cfbd293adc42f5a0bafc22 (patch)
treebf675ece5baae52ad8e311dd1b9de36514736c4c
parent449dd03960bf018889fc68eb9ff03ef613eb893b (diff)
downloadperl-1dc74fdba201402174cfbd293adc42f5a0bafc22.tar.gz
Revert "[perl #117855] Store CopFILEGV in a pad under ithreads"
This reverts commit c82ecf346. It turn out to be faulty, because a location shared betweens threads (the cop) was holding a reference count on a pad entry in a particu- lar thread. So when you free the cop, how do you know where to do SvREFCNT_dec? In reverting c82ecf346, this commit still preserves the bug fix from 1311cfc0a7b, but shifts it around.
-rw-r--r--MANIFEST2
-rw-r--r--cop.h49
-rw-r--r--embed.fnc5
-rw-r--r--embed.h1
-rw-r--r--embedvar.h3
-rw-r--r--ext/B/B.pm2
-rw-r--r--ext/B/B.xs11
-rw-r--r--ext/XS-APItest/APItest.xs7
-rw-r--r--ext/XS-APItest/t/copstash.t (renamed from ext/XS-APItest/t/cop.t)3
-rw-r--r--gv.c9
-rw-r--r--inline.h15
-rw-r--r--intrpvar.h3
-rw-r--r--makedef.pl3
-rw-r--r--op.c66
-rw-r--r--perl.c2
-rw-r--r--proto.h10
-rw-r--r--scope.c5
-rw-r--r--scope.h18
-rw-r--r--sv.c16
19 files changed, 69 insertions, 161 deletions
diff --git a/MANIFEST b/MANIFEST
index 68925b718d..0b408aeb02 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3870,7 +3870,7 @@ ext/XS-APItest/t/cleanup.t test stack behaviour on unwinding
ext/XS-APItest/t/clone-with-stack.t test clone with CLONEf_COPY_STACKS works
ext/XS-APItest/t/cophh.t test COPHH API
ext/XS-APItest/t/coplabel.t test cop_*_label
-ext/XS-APItest/t/cop.t test other cop stuff
+ext/XS-APItest/t/copstash.t test alloccopstash
ext/XS-APItest/t/copyhints.t test hv_copy_hints_hv() API
ext/XS-APItest/t/customop.t XS::APItest: tests for custom ops
ext/XS-APItest/t/eval-filter.t Simple source filter/eval test
diff --git a/cop.h b/cop.h
index 3deb2f8c05..4376e62891 100644
--- a/cop.h
+++ b/cop.h
@@ -389,8 +389,7 @@ struct cop {
#ifdef USE_ITHREADS
PADOFFSET cop_stashoff; /* offset into PL_stashpad, for the
package the line was compiled in */
- PADOFFSET cop_filegvoff; /* PL_filegv offset, for the file name the
- following line # is from */
+ char * cop_file; /* file name the following line # is from */
#else
HV * cop_stash; /* package line was compiled in */
GV * cop_filegv; /* file the following line # is from */
@@ -405,32 +404,54 @@ struct cop {
};
#ifdef USE_ITHREADS
-# define CopFILEGV(c) PL_filegvpad[(c)->cop_filegvoff]
-# define CopFILEGV_set(c,gv) ((c)->cop_filegvoff = (gv) \
- ? allocfilegv((GV *)SvREFCNT_inc_NN(gv)) \
- : 0)
+# define CopFILE(c) ((c)->cop_file)
+# define CopFILEGV(c) (CopFILE(c) \
+ ? gv_fetchfile(CopFILE(c)) : NULL)
+
+# ifdef NETWARE
+# define CopFILE_set(c,pv) ((c)->cop_file = savepv(pv))
+# define CopFILE_setn(c,pv,l) ((c)->cop_file = savepv((pv),(l)))
+# else
+# define CopFILE_set(c,pv) ((c)->cop_file = savesharedpv(pv))
+# define CopFILE_setn(c,pv,l) ((c)->cop_file = savesharedpvn((pv),(l)))
+# endif
+
+# define CopFILESV(c) (CopFILE(c) \
+ ? GvSV(gv_fetchfile(CopFILE(c))) : NULL)
+# define CopFILEAV(c) (CopFILE(c) \
+ ? GvAV(gv_fetchfile(CopFILE(c))) : NULL)
+# define CopFILEAVx(c) (assert_(CopFILE(c)) \
+ GvAV(gv_fetchfile(CopFILE(c))))
# define CopSTASH(c) PL_stashpad[(c)->cop_stashoff]
# define CopSTASH_set(c,hv) ((c)->cop_stashoff = (hv) \
? alloccopstash(hv) \
: 0)
-# define CopFILE_free(c) S_CopFILE_free(aTHX_ c)
+# ifdef NETWARE
+# define CopFILE_free(c) SAVECOPFILE_FREE(c)
+# else
+# define CopFILE_free(c) (PerlMemShared_free(CopFILE(c)),(CopFILE(c) = NULL))
+# endif
#else
# define CopFILEGV(c) ((c)->cop_filegv)
# define CopFILEGV_set(c,gv) ((c)->cop_filegv = (GV*)SvREFCNT_inc(gv))
+# define CopFILE_set(c,pv) CopFILEGV_set((c), gv_fetchfile(pv))
+# define CopFILE_setn(c,pv,l) CopFILEGV_set((c), gv_fetchfile_flags((pv),(l),0))
+# define CopFILESV(c) (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : NULL)
+# define CopFILEAV(c) (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : NULL)
+# ifdef DEBUGGING
+# define CopFILEAVx(c) (assert(CopFILEGV(c)), GvAV(CopFILEGV(c)))
+# else
+# define CopFILEAVx(c) (GvAV(CopFILEGV(c)))
+# endif
+# define CopFILE(c) (CopFILEGV(c) \
+ ? GvNAME(CopFILEGV(c))+2 : NULL)
# define CopSTASH(c) ((c)->cop_stash)
# define CopSTASH_set(c,hv) ((c)->cop_stash = (hv))
# define CopFILE_free(c) (SvREFCNT_dec(CopFILEGV(c)),(CopFILEGV(c) = NULL))
#endif /* USE_ITHREADS */
-#define CopFILE_set(c,pv) CopFILEGV_set((c), gv_fetchfile(pv))
-#define CopFILE_setn(c,pv,l) CopFILEGV_set((c), gv_fetchfile_flags((pv),(l),0))
-#define CopFILESV(c) (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : NULL)
-#define CopFILEAV(c) (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : NULL)
-#define CopFILEAVx(c) (assert_(CopFILEGV(c)) GvAV(CopFILEGV(c)))
-#define CopFILE(c) (CopFILEGV(c) \
- ? GvNAME(CopFILEGV(c))+2 : NULL)
#define CopSTASHPV(c) (CopSTASH(c) ? HvNAME_get(CopSTASH(c)) : NULL)
/* cop_stash is not refcounted */
#define CopSTASHPV_set(c,pv) CopSTASH_set((c), gv_stashpv(pv,GV_ADD))
diff --git a/embed.fnc b/embed.fnc
index d139eb9770..5fede447dd 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -1024,7 +1024,6 @@ p |PADOFFSET|allocmy |NN const char *const name|const STRLEN len\
|const U32 flags
#ifdef USE_ITHREADS
AMp |PADOFFSET|alloccopstash|NN HV *hv
-AMp |PADOFFSET|allocfilegv |NN GV *gv
#endif
: Used in perly.y
pR |OP* |oopsAV |NN OP* o
@@ -2660,8 +2659,4 @@ op |void |populate_isa |NN const char *name|STRLEN len|...
Xop |bool |feature_is_enabled|NN const char *const name \
|STRLEN namelen
-: Some static inline functions that implement macros need predeclaration
-: because they are used inside other static inline functions.
-Aoi |void |SvREFCNT_dec_NN|NN SV *sv
-
: ex: set ts=8 sts=4 sw=4 noet:
diff --git a/embed.h b/embed.h
index 5d9bc1e71c..9b5125a342 100644
--- a/embed.h
+++ b/embed.h
@@ -806,7 +806,6 @@
#endif
#if defined(USE_ITHREADS)
#define alloccopstash(a) Perl_alloccopstash(aTHX_ a)
-#define allocfilegv(a) Perl_allocfilegv(aTHX_ a)
#define any_dup(a,b) Perl_any_dup(aTHX_ a,b)
#define cx_dup(a,b,c,d) Perl_cx_dup(aTHX_ a,b,c,d)
#define dirp_dup(a,b) Perl_dirp_dup(aTHX_ a,b)
diff --git a/embedvar.h b/embedvar.h
index 240d205c8f..ef2fa686a8 100644
--- a/embedvar.h
+++ b/embedvar.h
@@ -146,9 +146,6 @@
#define PL_exitlist (vTHX->Iexitlist)
#define PL_exitlistlen (vTHX->Iexitlistlen)
#define PL_fdpid (vTHX->Ifdpid)
-#define PL_filegvpad (vTHX->Ifilegvpad)
-#define PL_filegvpadix (vTHX->Ifilegvpadix)
-#define PL_filegvpadmax (vTHX->Ifilegvpadmax)
#define PL_filemode (vTHX->Ifilemode)
#define PL_firstgv (vTHX->Ifirstgv)
#define PL_forkprocess (vTHX->Iforkprocess)
diff --git a/ext/B/B.pm b/ext/B/B.pm
index aa8dfef825..35b81cf7cb 100644
--- a/ext/B/B.pm
+++ b/ext/B/B.pm
@@ -1228,8 +1228,6 @@ Since perl 5.17.1
=item file
-=item filegvoff (threaded only)
-
=item cop_seq
=item arybase
diff --git a/ext/B/B.xs b/ext/B/B.xs
index 502fb46218..23e7620b6a 100644
--- a/ext/B/B.xs
+++ b/ext/B/B.xs
@@ -682,11 +682,7 @@ struct OP_methods {
#ifdef USE_ITHREADS
STR_WITH_LEN("pmoffset"),IVp, offsetof(struct pmop, op_pmoffset),/*20*/
STR_WITH_LEN("filegv"), op_offset_special, 0, /*21*/
-# if PERL_VERSION < 19
STR_WITH_LEN("file"), char_pp, offsetof(struct cop, cop_file), /*22*/
-# else
- STR_WITH_LEN("file"), op_offset_special, 0, /*22*/
-# endif
STR_WITH_LEN("stash"), op_offset_special, 0, /*23*/
# if PERL_VERSION < 17
STR_WITH_LEN("stashpv"), char_pp, offsetof(struct cop, cop_stashpv), /*24*/
@@ -732,11 +728,6 @@ struct OP_methods {
STR_WITH_LEN("folded"), op_offset_special, 0, /*50*/
#endif
#endif
-#if PERL_VERSION < 19 || !defined(USE_ITHREADS)
- STR_WITH_LEN("filegvoff"),op_offset_special, 0, /*51*/
-#else
- STR_WITH_LEN("filegvoff"),PADOFFSETp,offsetof(struct cop, cop_filegvoff),/*51*/
-#endif
};
#include "const-c.inc"
@@ -1040,7 +1031,7 @@ next(o)
ret = make_sv_object(aTHX_ (SV *)CopFILEGV((COP*)o));
break;
#endif
-#if !defined(USE_ITHREADS) || PERL_VERSION >= 19
+#ifndef USE_ITHREADS
case 22: /* file */
ret = sv_2mortal(newSVpv(CopFILE((COP*)o), 0));
break;
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index c0e18e5aa0..8eaabdb66a 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -3387,13 +3387,6 @@ CODE:
OUTPUT:
RETVAL
-bool
-test_allocfilegv()
-CODE:
- RETVAL = PL_filegvpad[allocfilegv(PL_defgv)] == PL_defgv;
-OUTPUT:
- RETVAL
-
#endif
bool
diff --git a/ext/XS-APItest/t/cop.t b/ext/XS-APItest/t/copstash.t
index b5571e6aec..8ed98a231b 100644
--- a/ext/XS-APItest/t/cop.t
+++ b/ext/XS-APItest/t/copstash.t
@@ -2,9 +2,8 @@ use Config;
use Test::More;
BEGIN { plan skip_all => 'no threads' unless $Config{useithreads} }
-plan tests => 2;
+plan tests => 1;
use XS::APItest;
ok test_alloccopstash;
-ok test_allocfilegv;
diff --git a/gv.c b/gv.c
index a7fdd99706..869d237660 100644
--- a/gv.c
+++ b/gv.c
@@ -2105,9 +2105,12 @@ Perl_gv_check(pTHX_ HV *stash)
continue;
file = GvFILE(gv);
CopLINE_set(PL_curcop, GvLINE(gv));
- /* set file name for warning */
- CopFILE_setn(PL_curcop, file, HEK_LEN(GvFILE_HEK(gv)));
- SvREFCNT_dec(CopFILEGV(PL_curcop));
+#ifdef USE_ITHREADS
+ CopFILE(PL_curcop) = (char *)file; /* set for warning */
+#else
+ CopFILEGV(PL_curcop)
+ = gv_fetchfile_flags(file, HEK_LEN(GvFILE_HEK(gv)), 0);
+#endif
Perl_warner(aTHX_ packWARN(WARN_ONCE),
"Name \"%"HEKf"::%"HEKf
"\" used only once: possible typo",
diff --git a/inline.h b/inline.h
index 6b24ae57bf..2d09dcb81b 100644
--- a/inline.h
+++ b/inline.h
@@ -23,20 +23,6 @@ S_av_top_index(pTHX_ AV *av)
return AvFILL(av);
}
-/* ------------------------------- cop.h ------------------------------ */
-
-#ifdef USE_ITHREADS
-PERL_STATIC_INLINE void
-S_CopFILE_free(pTHX_ COP * const c)
-{
- GV * const gv = CopFILEGV(c);
- if (!gv) return;
- if (SvREFCNT(gv) == 1) PL_filegvpad[c->cop_filegvoff] = NULL;
- SvREFCNT_dec_NN(gv);
- c->cop_filegvoff = 0;
-}
-#endif
-
/* ------------------------------- cv.h ------------------------------- */
PERL_STATIC_INLINE I32 *
@@ -122,7 +108,6 @@ PERL_STATIC_INLINE void
S_SvREFCNT_dec_NN(pTHX_ SV *sv)
{
U32 rc = SvREFCNT(sv);
- PERL_ARGS_ASSERT_SVREFCNT_DEC_NN;
if (LIKELY(rc > 1))
SvREFCNT(sv) = rc - 1;
else
diff --git a/intrpvar.h b/intrpvar.h
index ea37d41b5f..299ac0f7eb 100644
--- a/intrpvar.h
+++ b/intrpvar.h
@@ -657,9 +657,6 @@ PERLVAR(I, regex_padav, AV *) /* All regex objects, indexed via the
PERLVAR(I, stashpad, HV **) /* for CopSTASH */
PERLVARI(I, stashpadmax, PADOFFSET, 64)
PERLVARI(I, stashpadix, PADOFFSET, 0)
-PERLVAR(I, filegvpad, GV **) /* for CopFILEGV */
-PERLVARI(I, filegvpadmax, PADOFFSET, 64)
-PERLVARI(I, filegvpadix, PADOFFSET, 0)
#endif
#ifdef USE_REENTRANT_API
diff --git a/makedef.pl b/makedef.pl
index a5b99a758a..cd0d3fec40 100644
--- a/makedef.pl
+++ b/makedef.pl
@@ -363,9 +363,6 @@ unless ($define{'USE_ITHREADS'}) {
PL_stashpad
PL_stashpadix
PL_stashpadmax
- PL_filegvpad
- PL_filegvpadix
- PL_filegvpadmax
Perl_alloccopstash
Perl_allocfilegv
Perl_clone_params_del
diff --git a/op.c b/op.c
index f6d73a3073..09ab4f3707 100644
--- a/op.c
+++ b/op.c
@@ -634,64 +634,31 @@ C<PL_stashpad> for the stash passed to it.
*/
#ifdef USE_ITHREADS
-
PADOFFSET
-S_alloc_global_pad_slot(pTHX_ SV *sv, svtype type, SV ***padp,
- PADOFFSET *ixp, PADOFFSET *maxp)
+Perl_alloccopstash(pTHX_ HV *hv)
{
PADOFFSET off = 0, o = 1;
bool found_slot = FALSE;
- SV **pad = *padp;
- if (pad[*ixp] == sv) return *ixp;
+ PERL_ARGS_ASSERT_ALLOCCOPSTASH;
+
+ if (PL_stashpad[PL_stashpadix] == hv) return PL_stashpadix;
- for (; o < *maxp; ++o) {
- if (pad[o] == sv) return *ixp = o;
- if (!pad[o] || SvTYPE(pad[o]) != type)
+ for (; o < PL_stashpadmax; ++o) {
+ if (PL_stashpad[o] == hv) return PL_stashpadix = o;
+ if (!PL_stashpad[o] || SvTYPE(PL_stashpad[o]) != SVt_PVHV)
found_slot = TRUE, off = o;
}
if (!found_slot) {
- Renew(*padp, *maxp + 10, SV *);
- pad = *padp;
- Zero(pad + *maxp, 10, SV *);
- off = *maxp;
- *maxp += 10;
+ Renew(PL_stashpad, PL_stashpadmax + 10, HV *);
+ Zero(PL_stashpad + PL_stashpadmax, 10, HV *);
+ off = PL_stashpadmax;
+ PL_stashpadmax += 10;
}
- pad[*ixp = off] = sv;
+ PL_stashpad[PL_stashpadix = off] = hv;
return off;
}
-
-PADOFFSET
-Perl_alloccopstash(pTHX_ HV *hv)
-{
- PERL_ARGS_ASSERT_ALLOCCOPSTASH;
- return S_alloc_global_pad_slot(aTHX_
- (SV *)hv, SVt_PVHV, (SV ***)&PL_stashpad, &PL_stashpadix,
- &PL_stashpadmax
- );
-}
-#endif
-
-/*
-=for apidoc allocfilegv
-
-Available only under threaded builds, this function allocates an entry in
-C<PL_filegvpad> for the GV passed to it.
-
-=cut
-*/
-
-#ifdef USE_ITHREADS
-PADOFFSET
-Perl_allocfilegv(pTHX_ GV *gv)
-{
- PERL_ARGS_ASSERT_ALLOCFILEGV;
- return S_alloc_global_pad_slot(aTHX_
- (SV *)gv, SVt_PVGV, (SV ***)&PL_filegvpad, &PL_filegvpadix,
- &PL_filegvpadmax
- );
-}
#endif
/* free the body of an op without examining its contents.
@@ -5752,10 +5719,7 @@ Perl_newSTATEOP(pTHX_ I32 flags, char *label, OP *o)
PL_parser->copline = NOLINE;
}
#ifdef USE_ITHREADS
- /* While CopFILEGV_set does work under ithreads, this is faster, as it
- avoids a linear scan of the filegv pad: */
- if((cop->cop_filegvoff = PL_curcop->cop_filegvoff))
- SvREFCNT_inc_void_NN(PL_filegvpad[cop->cop_filegvoff]);
+ CopFILE_set(cop, CopFILE(PL_curcop)); /* XXX share in a pvtable? */
#else
CopFILEGV_set(cop, CopFILEGV(PL_curcop));
#endif
@@ -10898,7 +10862,7 @@ Perl_rpeep(pTHX_ OP *o)
firstcop->cop_line = secondcop->cop_line;
#ifdef USE_ITHREADS
firstcop->cop_stashoff = secondcop->cop_stashoff;
- firstcop->cop_filegvoff = secondcop->cop_filegvoff;
+ firstcop->cop_file = secondcop->cop_file;
#else
firstcop->cop_stash = secondcop->cop_stash;
firstcop->cop_filegv = secondcop->cop_filegv;
@@ -10910,7 +10874,7 @@ Perl_rpeep(pTHX_ OP *o)
#ifdef USE_ITHREADS
secondcop->cop_stashoff = 0;
- secondcop->cop_filegvoff = 0;
+ secondcop->cop_file = NULL;
#else
secondcop->cop_stash = NULL;
secondcop->cop_filegv = NULL;
diff --git a/perl.c b/perl.c
index 56635497d9..f31c1ed728 100644
--- a/perl.c
+++ b/perl.c
@@ -286,7 +286,6 @@ perl_construct(pTHXx)
Perl_av_create_and_push(aTHX_ &PL_regex_padav, newSVpvs(""));
PL_regex_pad = AvARRAY(PL_regex_padav);
Newxz(PL_stashpad, PL_stashpadmax, HV *);
- Newxz(PL_filegvpad, PL_filegvpadmax, GV *);
#endif
#ifdef USE_REENTRANT_API
Perl_reentrant_init(aTHX);
@@ -1093,7 +1092,6 @@ perl_destruct(pTHXx)
#ifdef USE_ITHREADS
Safefree(PL_stashpad); /* must come after sv_clean_all */
- Safefree(PL_filegvpad);
#endif
AvREAL_off(PL_fdpid); /* no surviving entries */
diff --git a/proto.h b/proto.h
index 202790c605..76ec13d1b9 100644
--- a/proto.h
+++ b/proto.h
@@ -32,11 +32,6 @@ PERL_CALLCONV void Perl_Slab_Free(pTHX_ void *op)
#define PERL_ARGS_ASSERT_SLAB_FREE \
assert(op)
-PERL_STATIC_INLINE void S_SvREFCNT_dec_NN(pTHX_ SV *sv)
- __attribute__nonnull__(pTHX_1);
-#define PERL_ARGS_ASSERT_SVREFCNT_DEC_NN \
- assert(sv)
-
PERL_CALLCONV bool Perl__is_uni_FOO(pTHX_ const U8 classnum, const UV c)
__attribute__warn_unused_result__;
@@ -7651,11 +7646,6 @@ PERL_CALLCONV PADOFFSET Perl_alloccopstash(pTHX_ HV *hv)
#define PERL_ARGS_ASSERT_ALLOCCOPSTASH \
assert(hv)
-PERL_CALLCONV PADOFFSET Perl_allocfilegv(pTHX_ GV *gv)
- __attribute__nonnull__(pTHX_1);
-#define PERL_ARGS_ASSERT_ALLOCFILEGV \
- assert(gv)
-
PERL_CALLCONV void* Perl_any_dup(pTHX_ void* v, const PerlInterpreter* proto_perl)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_2);
diff --git a/scope.c b/scope.c
index abef454c44..4939441e25 100644
--- a/scope.c
+++ b/scope.c
@@ -1228,11 +1228,6 @@ Perl_leave_scope(pTHX_ I32 base)
case SAVEt_READONLY_OFF:
SvREADONLY_off(ARG0_SV);
break;
-#ifdef USE_ITHREADS
- case SAVEt_COPFILEFREE:
- CopFILE_free((COP *)ARG0_PTR);
- break;
-#endif
default:
Perl_croak(aTHX_ "panic: leave_scope inconsistency %u", type);
}
diff --git a/scope.h b/scope.h
index d282ff6a8f..6afee0939c 100644
--- a/scope.h
+++ b/scope.h
@@ -39,14 +39,12 @@
#define SAVEt_PARSER 19
#define SAVEt_STACK_POS 20
#define SAVEt_READONLY_OFF 21
-#ifdef USE_ITHREADS
-# define SAVEt_COPFILEFREE 22
-#endif
-#define SAVEt_ARG1_MAX 22
+#define SAVEt_ARG1_MAX 21
/* two args */
+#define SAVEt_APTR 22
#define SAVEt_AV 23
#define SAVEt_DESTRUCTOR 24
#define SAVEt_DESTRUCTOR_X 25
@@ -71,18 +69,17 @@
#define SAVEt_SVREF 44
#define SAVEt_VPTR 45
#define SAVEt_ADELETE 46
-#define SAVEt_APTR 47
-#define SAVEt_ARG2_MAX 47
+#define SAVEt_ARG2_MAX 46
/* three args */
+#define SAVEt_DELETE 47
#define SAVEt_HELEM 48
#define SAVEt_PADSV_AND_MORTALIZE 49
#define SAVEt_SET_SVFLAGS 50
#define SAVEt_GVSLOT 51
#define SAVEt_AELEM 52
-#define SAVEt_DELETE 53
#define SAVEf_SETMAGIC 1
#define SAVEf_KEEPOLDELEM 2
@@ -295,11 +292,8 @@ scope has the given name. Name must be a literal string.
#ifdef USE_ITHREADS
# define SAVECOPSTASH_FREE(c) SAVEIV((c)->cop_stashoff)
-# define SAVECOPFILE(c) SAVEIV((c)->cop_filegvoff)
-# define SAVECOPFILE_FREE(c) ( \
- SAVEIV((c)->cop_filegvoff), \
- save_pushptr((void *)(c), SAVEt_COPFILEFREE) \
- )
+# define SAVECOPFILE(c) SAVEPPTR(CopFILE(c))
+# define SAVECOPFILE_FREE(c) SAVESHAREDPV(CopFILE(c))
#else
# /* XXX not refcounted */
# define SAVECOPSTASH_FREE(c) SAVESPTR(CopSTASH(c))
diff --git a/sv.c b/sv.c
index 283178f0b5..0e4ae37f47 100644
--- a/sv.c
+++ b/sv.c
@@ -13032,10 +13032,6 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
ptr = POPPTR(ss,ix);
TOPPTR(nss,ix) = parser_dup((const yy_parser*)ptr, param);
break;
- case SAVEt_COPFILEFREE:
- ptr = POPPTR(ss,ix);
- TOPPTR(nss,ix) = any_dup(ptr, param->proto_perl);
- break;
default:
Perl_croak(aTHX_
"panic: ss_dup inconsistency (%"IVdf")", (IV) type);
@@ -13485,6 +13481,10 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
Zero(PL_sv_consts, SV_CONSTS_COUNT, SV*);
+ /* This PV will be free'd special way so must set it same way op.c does */
+ PL_compiling.cop_file = savesharedpv(PL_compiling.cop_file);
+ ptr_table_store(PL_ptr_table, proto_perl->Icompiling.cop_file, PL_compiling.cop_file);
+
ptr_table_store(PL_ptr_table, &proto_perl->Icompiling, &PL_compiling);
PL_compiling.cop_warnings = DUP_WARNINGS(PL_compiling.cop_warnings);
CopHINTHASH_set(&PL_compiling, cophh_copy(CopHINTHASH_get(&PL_compiling)));
@@ -13546,14 +13546,6 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
for (; o < PL_stashpadmax; ++o)
PL_stashpad[o] = hv_dup(proto_perl->Istashpad[o], param);
}
- PL_filegvpadmax = proto_perl->Ifilegvpadmax;
- PL_filegvpadix = proto_perl->Ifilegvpadix ;
- Newx(PL_filegvpad, PL_filegvpadmax, GV *);
- {
- PADOFFSET o = 0;
- for (; o < PL_filegvpadmax; ++o)
- PL_filegvpad[o] = gv_dup(proto_perl->Ifilegvpad[o], param);
- }
/* shortcuts to various I/O objects */
PL_ofsgv = gv_dup_inc(proto_perl->Iofsgv, param);