X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/6a5b4183fb7901110d40b26a7e60b0950cc9465d..51da40ed5ad9513dc5f2213b76a414e9eb4c239d:/hv.h diff --git a/hv.h b/hv.h index 0d619f2..6ebd5d5 100644 --- a/hv.h +++ b/hv.h @@ -11,17 +11,21 @@ /* 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. */ -#define PERL_HASH_RANDOMIZE_KEYS 1 -#define USE_PERL_PERTURB_KEYS 1 - -#ifdef PERL_HASH_RANDOMIZE_KEYS -# if defined(DEBUGGING) || defined(USE_PERL_PERTURB_KEYS) -# define PL_HASH_RAND_BITS_ENABLED PL_hash_rand_bits_enabled -# endif -# define PERL_HASH_ITER_BUCKET(iter) (((iter)->xhv_riter) ^ ((iter)->xhv_rand)) +#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_ITER_BUCKET(iter) ((iter)->xhv_riter) +# 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 */ @@ -113,6 +117,7 @@ struct xpvhv_aux { U32 xhv_last_rand; /* last random value for hash traversal, used to detect each() after insert for warnings */ #endif + U32 xhv_fill_lazy; }; /* hash structure: */ @@ -235,7 +240,7 @@ C. # define Nullhv Null(HV*) #endif #define HvARRAY(hv) ((hv)->sv_u.svu_hash) -#define HvFILL(hv) Perl_hv_fill(aTHX_ (const HV *)(hv)) +#define HvFILL(hv) Perl_hv_fill(aTHX_ MUTABLE_HV(hv)) #define HvMAX(hv) ((XPVHV*) SvANY(hv))->xhv_max /* This quite intentionally does no flag checking first. That's your responsibility. */