[svn:parrot] r47787 - trunk/src/pmc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Wed Jun 23 19:17:37 UTC 2010


Author: chromatic
Date: Wed Jun 23 19:17:36 2010
New Revision: 47787
URL: https://trac.parrot.org/parrot/changeset/47787

Log:
[PMC] Added a quick constant string pointer check to Default PMC's isa as a
minor optimization.

Modified:
   trunk/src/pmc/default.pmc

Modified: trunk/src/pmc/default.pmc
==============================================================================
--- trunk/src/pmc/default.pmc	Wed Jun 23 16:50:21 2010	(r47786)
+++ trunk/src/pmc/default.pmc	Wed Jun 23 19:17:36 2010	(r47787)
@@ -968,11 +968,15 @@
 */
 
     VTABLE INTVAL isa(STRING *_class) {
-        const Hash * const isa_hash = SELF->vtable->isa_hash;
-        if (!isa_hash)
-            return Parrot_str_equal(INTERP, SELF->vtable->whoami, _class);
+        if (SELF->vtable->whoami == _class)
+            return 1;
+        else {
+            const Hash * const isa_hash = SELF->vtable->isa_hash;
+            if (!isa_hash)
+                return Parrot_str_equal(INTERP, SELF->vtable->whoami, _class);
 
-        return parrot_hash_exists(INTERP, isa_hash, (void *)_class);
+            return parrot_hash_exists(INTERP, isa_hash, (void *)_class);
+        }
     }
 
 /*


More information about the parrot-commits mailing list