/* hv.h * * Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, * 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, by Larry Wall and others * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ /* These control hash traversal randomization and the environment variable PERL_PERTURB_KEYS. * Currently disabling this functionality will break a few tests, but should otherwise work fine. * See perlrun for more details. */ #if defined(PERL_PERTURB_KEYS_DISABLED) # define PL_HASH_RAND_BITS_ENABLED 0 # define PERL_HASH_ITER_BUCKET(iter) ((iter)->xhv_riter) #else # define PERL_HASH_RANDOMIZE_KEYS 1 # if defined(PERL_PERTURB_KEYS_RANDOM) # define PL_HASH_RAND_BITS_ENABLED 1 # elif defined(PERL_PERTURB_KEYS_DETERMINISTIC) # define PL_HASH_RAND_BITS_ENABLED 2 # else # define USE_PERL_PERTURB_KEYS 1 # define PL_HASH_RAND_BITS_ENABLED PL_hash_rand_bits_enabled # endif # define PERL_HASH_ITER_BUCKET(iter) (((iter)->xhv_riter) ^ ((iter)->xhv_rand)) #endif /* entry in hash value chain */ struct he { /* Keep hent_next first in this structure, because sv_free_arenas take advantage of this to share code between the he arenas and the SV body arenas */ HE *hent_next; /* next entry in chain */ HEK *hent_hek; /* hash key */ union { SV *hent_val; /* scalar value that was hashed */ Size_t hent_refcount; /* references for this shared hash key */ } he_valu; }; /* hash key -- defined separately for use as shared pointer */ struct hek { U32 hek_hash; /* hash of key */ I32 hek_len; /* length of hash key */ char hek_key[1]; /* variable-length hash key */ /* the hash-key is \0-terminated */ /* after the \0 there is a byte for flags, such as whether the key is UTF-8 */ }; struct shared_he { struct he shared_he_he; struct hek shared_he_hek; }; /* Subject to change. Don't access this directly. Use the funcs in mro_core.c */