diff options
author | Nicholas Clark <nick@ccl4.org> | 2021-08-21 19:28:14 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2021-08-23 08:29:09 +0000 |
commit | 009b864d9e6614ebbaed4f82c3bd6de967b53856 (patch) | |
tree | b0ba641519f9960203af7f0407acf76f1abe5f40 /mro_core.c | |
parent | ded520dc1b4f4e452d606f7acda4700ae023932a (diff) | |
download | perl-009b864d9e6614ebbaed4f82c3bd6de967b53856.tar.gz |
Pre-extend the ISA hash in Perl_mro_get_linear_isa().
Diffstat (limited to 'mro_core.c')
-rw-r--r-- | mro_core.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/mro_core.c b/mro_core.c index 24f4c536fc..04b9060c89 100644 --- a/mro_core.c +++ b/mro_core.c @@ -440,11 +440,16 @@ Perl_mro_get_linear_isa(pTHX_ HV *stash) if (!meta->isa) { HV *const isa_hash = newHV(); /* Linearisation didn't build it for us, so do it here. */ + I32 count = AvFILLp(isa) + 1; SV *const *svp = AvARRAY(isa); - SV *const *const svp_end = svp + AvFILLp(isa) + 1; + SV *const *const svp_end = svp + count; const HEK *canon_name = HvENAME_HEK(stash); if (!canon_name) canon_name = HvNAME_HEK(stash); + if (count > PERL_HASH_DEFAULT_HvMAX) { + hv_ksplit(isa_hash, count); + } + while (svp < svp_end) { (void) hv_store_ent(isa_hash, *svp++, &PL_sv_undef, 0); } |