summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-07-05 22:51:50 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-08-05 02:23:28 -0700
commitc82ecf346a8512f22f25188e450d92938c245421 (patch)
tree4a8a85a9655bcb136136674dc3f838204bc9d202 /gv.c
parent38be3d0038ef87b22af88f80db1fbeb0292ce53b (diff)
downloadperl-c82ecf346a8512f22f25188e450d92938c245421.tar.gz
[perl #117855] Store CopFILEGV in a pad under ithreads
This saves having to allocate a separate string buffer for every cop (control op; every statement has one). Under non-threaded builds, every cop has a pointer to the GV for that source file, namely *{"_<filename"}. Under threaded builds, the name of the GV used to be stored instead. Now we store an offset into the per-interpreter PL_filegvpad, which points to the GV. This makes no significant speed difference, but it reduces mem- ory usage.
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/gv.c b/gv.c
index 067847cf4f..b66eced626 100644
--- a/gv.c
+++ b/gv.c
@@ -2102,12 +2102,9 @@ Perl_gv_check(pTHX_ const HV *stash)
continue;
file = GvFILE(gv);
CopLINE_set(PL_curcop, GvLINE(gv));
-#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
+ /* set file name for warning */
+ CopFILE_setn(PL_curcop, file, HEK_LEN(GvFILE_HEK(gv)));
+ SvREFCNT_dec(CopFILEGV(PL_curcop));
Perl_warner(aTHX_ packWARN(WARN_ONCE),
"Name \"%"HEKf"::%"HEKf
"\" used only once: possible typo",