summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-06-12 22:33:51 +0000
committerNicholas Clark <nick@ccl4.org>2005-06-12 22:33:51 +0000
commit658b4a4a328256e2a80066c57ca7866646757dad (patch)
tree9a9396ac38b2a80442fb319648289b67fdace7d1 /hv.c
parentd1db91c62f7fa6ddc9f9a29f5ba20b5d381c9d4b (diff)
downloadperl-658b4a4a328256e2a80066c57ca7866646757dad.tar.gz
hek_dup can now store the HEK rather than the HE, as there is now a
fast way to share a hek p4raw-id: //depot/perl@24812
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/hv.c b/hv.c
index b779e35bc8..68a95976ec 100644
--- a/hv.c
+++ b/hv.c
@@ -126,19 +126,20 @@ Perl_free_tied_hv_pool(pTHX)
HEK *
Perl_hek_dup(pTHX_ HEK *source, CLONE_PARAMS* param)
{
- HE *shared = (HE*)ptr_table_fetch(PL_shared_hek_table, source);
+ HEK *shared = (HEK*)ptr_table_fetch(PL_ptr_table, source);
(void)param;
if (shared) {
/* We already shared this hash key. */
- ++HeVAL(shared);
+ share_hek_hek(shared);
}
else {
- shared = share_hek_flags(HEK_KEY(source), HEK_LEN(source),
- HEK_HASH(source), HEK_FLAGS(source));
- ptr_table_store(PL_shared_hek_table, source, shared);
+ shared
+ = HeKEY_hek(share_hek_flags(HEK_KEY(source), HEK_LEN(source),
+ HEK_HASH(source), HEK_FLAGS(source)));
+ ptr_table_store(PL_ptr_table, source, shared);
}
- return HeKEY_hek(shared);
+ return shared;
}
HE *
@@ -168,18 +169,20 @@ Perl_he_dup(pTHX_ HE *e, bool shared, CLONE_PARAMS* param)
/* This is hek_dup inlined, which seems to be important for speed
reasons. */
HEK *source = HeKEY_hek(e);
- HE *shared = (HE*)ptr_table_fetch(PL_shared_hek_table, source);
+ HEK *shared = (HEK*)ptr_table_fetch(PL_ptr_table, source);
if (shared) {
/* We already shared this hash key. */
- ++HeVAL(shared);
+ share_hek_hek(shared);
}
else {
- shared = share_hek_flags(HEK_KEY(source), HEK_LEN(source),
- HEK_HASH(source), HEK_FLAGS(source));
- ptr_table_store(PL_shared_hek_table, source, shared);
+ shared
+ = HeKEY_hek(share_hek_flags(HEK_KEY(source), HEK_LEN(source),
+ HEK_HASH(source),
+ HEK_FLAGS(source)));
+ ptr_table_store(PL_ptr_table, source, shared);
}
- HeKEY_hek(ret) = HeKEY_hek(shared);
+ HeKEY_hek(ret) = shared;
}
else
HeKEY_hek(ret) = save_hek_flags(HeKEY(e), HeKLEN(e), HeHASH(e),