summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--perl.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/perl.c b/perl.c
index 2d04271b9f..454cc756ba 100644
--- a/perl.c
+++ b/perl.c
@@ -371,15 +371,20 @@ perl_construct(pTHXx)
* constructing hashes */
PL_hash_seed_set= TRUE;
}
- /* Note that strtab is a rather special HV. Assumptions are made
- about not iterating on it, and not adding tie magic to it.
- It is properly deallocated in perl_destruct() */
- PL_strtab = newHV();
-
- /* SHAREKEYS tells us that the hash has its keys shared with PL_strtab,
- * which is not the case with PL_strtab itself */
- HvSHAREKEYS_off(PL_strtab); /* mandatory */
- hv_ksplit(PL_strtab, 1 << 11);
+
+ /* Allow PL_strtab to be pre-initialized before calling perl_construct.
+ * can use a custom optimized PL_strtab hash before calling perl_construct */
+ if (!PL_strtab) {
+ /* Note that strtab is a rather special HV. Assumptions are made
+ about not iterating on it, and not adding tie magic to it.
+ It is properly deallocated in perl_destruct() */
+ PL_strtab = newHV();
+
+ /* SHAREKEYS tells us that the hash has its keys shared with PL_strtab,
+ * which is not the case with PL_strtab itself */
+ HvSHAREKEYS_off(PL_strtab); /* mandatory */
+ hv_ksplit(PL_strtab, 1 << 11);
+ }
Zero(PL_sv_consts, SV_CONSTS_COUNT, SV*);