Change 34356 by [EMAIL PROTECTED] on 2008/09/12 09:25:55

        Build the isa cache from any linear ISA, rather than forcing the use
        of dfs. This avoids calling dfs on a C3 class (and all its parents),
        which won't break anything, but is more work than is needed.

Affected files ...

... //depot/perl/mro.c#52 edit

Differences ...

==== //depot/perl/mro.c#52 (text) ====
Index: perl/mro.c
--- perl/mro.c#51~34355~        2008-09-12 01:52:50.000000000 -0700
+++ perl/mro.c  2008-09-12 02:25:55.000000000 -0700
@@ -105,9 +105,28 @@
 
     PERL_ARGS_ASSERT_GET_ISA_HASH;
 
-    if (!meta->isa)
-       mro_get_linear_isa_dfs(stash, 0);
-    assert(meta->isa);
+    if (!meta->isa) {
+       AV *const isa = mro_get_linear_isa(stash);
+       if (!meta->isa) {
+           HV *const isa_hash = newHV();
+           /* Linearisation didn't build it for us, so do it here.  */
+           SV *const *svp = AvARRAY(isa);
+           SV *const *const svp_end = svp + AvFILLp(isa) + 1;
+           const HEK *const canon_name = HvNAME_HEK(stash);
+
+           while (svp < svp_end) {
+               (void) hv_store_ent(isa_hash, *svp++, &PL_sv_undef, 0);
+           }
+
+           (void) hv_common(isa_hash, NULL, HEK_KEY(canon_name),
+                            HEK_LEN(canon_name), HEK_FLAGS(canon_name),
+                            HV_FETCH_ISSTORE, &PL_sv_undef,
+                            HEK_HASH(canon_name));
+           (void) hv_store(isa_hash, "UNIVERSAL", 9, &PL_sv_undef, 0);
+
+           meta->isa = isa_hash;
+       }
+    }
     return meta->isa;
 }
 
End of Patch.

Reply via email to