[svn:parrot] r47734 - in trunk: lib/Parrot/Pmc2c src/pmc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Sun Jun 20 19:14:34 UTC 2010


Author: NotFound
Date: Sun Jun 20 19:14:33 2010
New Revision: 47734
URL: https://trac.parrot.org/parrot/changeset/47734

Log:
always fill isa_hash to avoid making special cases for null in several places

Modified:
   trunk/lib/Parrot/Pmc2c/PMCEmitter.pm
   trunk/src/pmc/class.pmc
   trunk/src/pmc/default.pmc
   trunk/src/pmc/pmcproxy.pmc

Modified: trunk/lib/Parrot/Pmc2c/PMCEmitter.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/PMCEmitter.pm	Sun Jun 20 16:48:56 2010	(r47733)
+++ trunk/lib/Parrot/Pmc2c/PMCEmitter.pm	Sun Jun 20 19:14:33 2010	(r47734)
@@ -506,8 +506,6 @@
     my $multi_list_size = @multi_list;
     my $multi_list = join( "\n", @multi_list);
 
-    my @isa = grep { $_ ne 'default' } @{ $self->parents };
-
     my $provides        = join( " ", keys( %{ $self->{flags}{provides} } ) );
     my $class_init_code = "";
 
@@ -586,17 +584,9 @@
 EOC
     }
 
-    if (@isa) {
-        unshift @isa, $classname;
-        $cout .= <<"EOC";
+    $cout .= <<"EOC";
         vt->isa_hash     = Parrot_${classname}_get_isa(interp, NULL);
 EOC
-    }
-    else {
-        $cout .= <<"EOC";
-        vt->isa_hash     = NULL;
-EOC
-    }
 
     for my $k ( keys %extra_vt ) {
         my $k_flags = $self->$k->vtable_flags;

Modified: trunk/src/pmc/class.pmc
==============================================================================
--- trunk/src/pmc/class.pmc	Sun Jun 20 16:48:56 2010	(r47733)
+++ trunk/src/pmc/class.pmc	Sun Jun 20 19:14:33 2010	(r47734)
@@ -1352,13 +1352,8 @@
         if (classobj->vtable->base_type == enum_class_Class
         ||  classobj->vtable->base_type == enum_class_PMCProxy) {
             STRING *classname = make_class_name(INTERP, classobj);
-
-            if (Parrot_str_equal(INTERP, SELF->vtable->whoami, classname))
-                return 1;
-
-            if (SELF->vtable->isa_hash
-            &&  parrot_hash_exists(INTERP, SELF->vtable->isa_hash,
-                                    (void *)classname))
+            PARROT_ASSERT(SELF->vtable->isa_hash);
+            if (parrot_hash_exists(INTERP, SELF->vtable->isa_hash, classname))
                 return 1;
         }
 

Modified: trunk/src/pmc/default.pmc
==============================================================================
--- trunk/src/pmc/default.pmc	Sun Jun 20 16:48:56 2010	(r47733)
+++ trunk/src/pmc/default.pmc	Sun Jun 20 19:14:33 2010	(r47734)
@@ -946,18 +946,13 @@
 */
 
     VTABLE INTVAL isa_pmc(PMC *lookup) {
-        Hash   * const isa_hash = SELF->vtable->isa_hash;
-        STRING *pmc_name;
-
         if (PMC_IS_NULL(lookup))
             return 0;
-
-        pmc_name = VTABLE_get_string(INTERP, lookup);
-
-        if (!isa_hash)
-            return Parrot_str_equal(INTERP, SELF->vtable->whoami, pmc_name);
-
-        return parrot_hash_exists(INTERP, isa_hash, (void *)pmc_name);
+        else {
+            Hash   * const isa_hash = SELF->vtable->isa_hash;
+            STRING * const pmc_name = VTABLE_get_string(INTERP, lookup);
+            return parrot_hash_exists(INTERP, isa_hash, pmc_name);
+        }
     }
 
 /*

Modified: trunk/src/pmc/pmcproxy.pmc
==============================================================================
--- trunk/src/pmc/pmcproxy.pmc	Sun Jun 20 16:48:56 2010	(r47733)
+++ trunk/src/pmc/pmcproxy.pmc	Sun Jun 20 19:14:33 2010	(r47734)
@@ -251,12 +251,8 @@
         /* Look in the isa hash. */
         if (INTERP->vtables[_proxy->id]) {
             Hash *isa_hash = INTERP->vtables[_proxy->id]->isa_hash;
-
-            if (!isa_hash && Parrot_str_equal(INTERP,
-                     INTERP->vtables[_proxy->id]->whoami, classname))
-                return 1;
-
-            if (isa_hash && parrot_hash_exists(INTERP, isa_hash, classname))
+            PARROT_ASSERT(isa_hash);
+            if (parrot_hash_exists(INTERP, isa_hash, classname))
                 return 1;
         }
 


More information about the parrot-commits mailing list