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 /scope.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 'scope.h')
-rw-r--r-- | scope.h | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -39,12 +39,14 @@ #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 21 +#define SAVEt_ARG1_MAX 22 /* two args */ -#define SAVEt_APTR 22 #define SAVEt_AV 23 #define SAVEt_DESTRUCTOR 24 #define SAVEt_DESTRUCTOR_X 25 @@ -69,17 +71,18 @@ #define SAVEt_SVREF 44 #define SAVEt_VPTR 45 #define SAVEt_ADELETE 46 +#define SAVEt_APTR 47 -#define SAVEt_ARG2_MAX 46 +#define SAVEt_ARG2_MAX 47 /* 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 @@ -301,8 +304,11 @@ 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) SAVEPPTR(CopFILE(c)) -# define SAVECOPFILE_FREE(c) SAVESHAREDPV(CopFILE(c)) +# define SAVECOPFILE(c) SAVEIV((c)->cop_filegvoff) +# define SAVECOPFILE_FREE(c) ( \ + SAVEIV((c)->cop_filegvoff), \ + save_pushptr((void *)(c), SAVEt_COPFILEFREE) \ + ) #else # /* XXX not refcounted */ # define SAVECOPSTASH_FREE(c) SAVESPTR(CopSTASH(c)) |