summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/pp.c b/pp.c
index f70d832cf2..10ba861529 100644
--- a/pp.c
+++ b/pp.c
@@ -5525,6 +5525,12 @@ PP(pp_anonhash)
SV* const retval = sv_2mortal( PL_op->op_flags & OPf_SPECIAL
? newRV_noinc(MUTABLE_SV(hv))
: MUTABLE_SV(hv) );
+ /* This isn't quite true for an odd sized list (it's one too few) but it's
+ not worth the runtime +1 just to optimise for the warning case. */
+ SSize_t pairs = (SP - MARK) >> 1;
+ if (pairs > PERL_HASH_DEFAULT_HvMAX) {
+ hv_ksplit(hv, pairs);
+ }
while (MARK < SP) {
SV * const key =