diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-07-05 22:51:50 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-08-05 02:23:28 -0700 |
commit | c82ecf346a8512f22f25188e450d92938c245421 (patch) | |
tree | 4a8a85a9655bcb136136674dc3f838204bc9d202 /inline.h | |
parent | 38be3d0038ef87b22af88f80db1fbeb0292ce53b (diff) | |
download | perl-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 'inline.h')
-rw-r--r-- | inline.h | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -23,6 +23,20 @@ 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 * @@ -108,6 +122,7 @@ 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 |