Skip to content

Commit

Permalink
Pre-extend the ISA hash in Perl_mro_get_linear_isa().
Browse files Browse the repository at this point in the history
  • Loading branch information
nwc10 committed Aug 23, 2021
1 parent ded520d commit 009b864
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mro_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 009b864

Please sign in to comment.