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 /ext/B | |
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 'ext/B')
-rw-r--r-- | ext/B/B.pm | 2 | ||||
-rw-r--r-- | ext/B/B.xs | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/ext/B/B.pm b/ext/B/B.pm index 35b81cf7cb..aa8dfef825 100644 --- a/ext/B/B.pm +++ b/ext/B/B.pm @@ -1228,6 +1228,8 @@ 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 9bafb387d7..2338be7bb9 100644 --- a/ext/B/B.xs +++ b/ext/B/B.xs @@ -680,7 +680,11 @@ struct OP_methods { #ifdef USE_ITHREADS STR_WITH_LEN("pmoffset"),IVp, offsetof(struct pmop, op_pmoffset),/*20*/ STR_WITH_LEN("filegv"), 0, -1, /*21*/ +# if PERL_VERSION < 19 STR_WITH_LEN("file"), char_pp, offsetof(struct cop, cop_file), /*22*/ +# else + STR_WITH_LEN("file"), 0, -1, /*22*/ +# endif STR_WITH_LEN("stash"), 0, -1, /*23*/ # if PERL_VERSION < 17 STR_WITH_LEN("stashpv"), char_pp, offsetof(struct cop, cop_stashpv), /*24*/ @@ -726,6 +730,11 @@ struct OP_methods { STR_WITH_LEN("folded"), 0, -1, /*50*/ #endif #endif +#if PERL_VERSION < 19 || !defined(USE_ITHREADS) + STR_WITH_LEN("filegvoff"),0, -1, /*51*/ +#else + STR_WITH_LEN("filegvoff"),PADOFFSETp,offsetof(struct cop, cop_filegvoff),/*51*/ +#endif }; #include "const-c.inc" @@ -1034,7 +1043,7 @@ next(o) ret = make_sv_object(aTHX_ (SV *)CopFILEGV((COP*)o)); break; #endif -#ifndef USE_ITHREADS +#if !defined(USE_ITHREADS) || PERL_VERSION >= 19 case 22: /* file */ ret = sv_2mortal(newSVpv(CopFILE((COP*)o), 0)); break; |