summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorRuslan Zakirov <ruz@bestpractical.com>2013-03-25 05:31:35 +0400
committerFather Chrysostomos <sprout@cpan.org>2013-06-30 11:43:41 -0700
commita38ab4751f3c0df44dc09e4d685a2637e93c9778 (patch)
tree81b350cb112e5aa7f0e659dbffd736e86bf0358a /perl.c
parentc106c2be8b83eeb3799c9f2127c5030a7a04115a (diff)
downloadperl-a38ab4751f3c0df44dc09e4d685a2637e93c9778.tar.gz
SV_CONST(name) and PL_sv_consts
SV_CONST(XXX) returns SV* that contains "XXX" string. SVs are built on demand and stored in interp's structure for re-use. All SVs have precomputed hash value. Creates SVs on demand, we don't want 35 SV created during compile time or cloned during thread creation.
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/perl.c b/perl.c
index 41b0a6403c..90b56951a2 100644
--- a/perl.c
+++ b/perl.c
@@ -308,6 +308,8 @@ perl_construct(pTHXx)
HvSHAREKEYS_off(PL_strtab); /* mandatory */
hv_ksplit(PL_strtab, 512);
+ Zero(PL_sv_consts, SV_CONSTS_COUNT, SV*);
+
#if defined(__DYNAMIC__) && (defined(NeXT) || defined(__NeXT__))
_dyld_lookup_and_bind
("__environ", (unsigned long *) &environ_pointer, NULL);
@@ -1081,6 +1083,12 @@ perl_destruct(pTHXx)
sys_intern_clear();
#endif
+ /* constant strings */
+ for (i = 0; i < SV_CONSTS_COUNT; i++) {
+ SvREFCNT_dec(PL_sv_consts[i]);
+ PL_sv_consts[i] = NULL;
+ }
+
/* Destruct the global string table. */
{
/* Yell and reset the HeVAL() slots that are still holding refcounts,