[pypy-svn] r65544 - pypy/branch/pyjitpl5-experiments/pypy/objspace/std

cfbolz at codespeak.net cfbolz at codespeak.net
Tue Jun 2 17:37:56 CEST 2009


Author: cfbolz
Date: Tue Jun  2 17:37:55 2009
New Revision: 65544

Modified:
   pypy/branch/pyjitpl5-experiments/pypy/objspace/std/typeobject.py
Log:
I think this should get rid of the remaining dict lookups on the type in the
residual code for an attribute access. It's not necessarily a good idea, as new
bridges will be made every time someone changes a counter on a class.


Modified: pypy/branch/pyjitpl5-experiments/pypy/objspace/std/typeobject.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/objspace/std/typeobject.py	(original)
+++ pypy/branch/pyjitpl5-experiments/pypy/objspace/std/typeobject.py	Tue Jun  2 17:37:55 2009
@@ -7,7 +7,7 @@
 from pypy.objspace.std.dictproxyobject import W_DictProxyObject
 from pypy.rlib.objectmodel import we_are_translated
 from pypy.rlib.objectmodel import current_object_addr_as_int
-from pypy.rlib.jit import hint
+from pypy.rlib.jit import hint, purefunction
 from pypy.rlib.rarithmetic import intmask, r_uint
 
 from copy_reg import _HEAPTYPE
@@ -189,6 +189,14 @@
         if version_tag is None:
             tup = w_self._lookup_where(name)
             return tup
+        w_self = hint(w_self, promote=True)
+        name = hint(name, promote=True)
+        version_tag = hint(version_tag, promote=True)
+        return w_self._pure_lookup_where_with_method_cache(name, version_tag)
+
+    @purefunction
+    def _pure_lookup_where_with_method_cache(w_self, name, version_tag):
+        space = w_self.space
         SHIFT = r_uint.BITS - space.config.objspace.std.methodcachesizeexp
         version_tag_as_int = current_object_addr_as_int(version_tag)
         # ^^^Note: if the version_tag object is moved by a moving GC, the



More information about the Pypy-commit mailing list