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

chromatic at svn.parrot.org chromatic at svn.parrot.org
Tue May 26 21:13:01 UTC 2009


Author: chromatic
Date: Tue May 26 21:13:01 2009
New Revision: 39185
URL: https://trac.parrot.org/parrot/changeset/39185

Log:
[OO] Reduced the amount of work required to get an attribute's index in the
Object PMC.  This is a modest optimization (measurable, but not huge).

Modified:
   trunk/src/pmc/object.pmc

Modified: trunk/src/pmc/object.pmc
==============================================================================
--- trunk/src/pmc/object.pmc	Tue May 26 21:12:15 2009	(r39184)
+++ trunk/src/pmc/object.pmc	Tue May 26 21:13:01 2009	(r39185)
@@ -29,13 +29,17 @@
     Parrot_Class_attributes * const _class  = PARROT_CLASS(self);
     const INTVAL                    cur_hll = CONTEXT(interp)->current_HLL;
     int                             num_classes, i;
+    INTVAL                          retval;
 
     CONTEXT(interp)->current_HLL = 0;
 
     /* First see if we can find it in the cache. */
-    if (VTABLE_exists_keyed_str(interp, _class->attrib_cache, name)) {
-        const INTVAL retval =
-            VTABLE_get_integer_keyed_str(interp, _class->attrib_cache, name);
+    retval                       = VTABLE_get_integer_keyed_str(interp,
+                                         _class->attrib_cache, name);
+
+    /* there's a semi-predicate problem with a retval of 0 */
+    if (retval
+    || VTABLE_exists_keyed_str(interp, _class->attrib_cache, name)) {
         CONTEXT(interp)->current_HLL = cur_hll;
         return retval;
     }


More information about the parrot-commits mailing list