[pypy-svn] r40164 - pypy/dist/pypy/objspace/std

arigo at codespeak.net arigo at codespeak.net
Sat Mar 10 15:29:40 CET 2007


Author: arigo
Date: Sat Mar 10 15:29:39 2007
New Revision: 40164

Modified:
   pypy/dist/pypy/objspace/std/typeobject.py
Log:
There is no longer a good reason for the method cache to
depend on the bytecode position, so let's comment it out.
That's less code and less things to explain in the EU report :-)


Modified: pypy/dist/pypy/objspace/std/typeobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/typeobject.py	(original)
+++ pypy/dist/pypy/objspace/std/typeobject.py	Sat Mar 10 15:29:39 2007
@@ -312,21 +312,22 @@
         space = w_self.space
         assert space.config.objspace.std.withmethodcache
         ec = space.getexecutioncontext()
-        try:
-            frame = ec.framestack.top()
-            position_hash = frame.last_instr ^ id(frame.pycode)
-        except IndexError:
-            position_hash = 0
+        #try:
+        #    frame = ec.framestack.top()
+        #    position_hash = frame.last_instr ^ id(frame.pycode)
+        #except IndexError:
+        #    position_hash = 0
         version_tag = w_self.version_tag
         if version_tag is None:
             tup = w_self._lookup_where(name)
             return tup
         MASK = 1 << space.config.objspace.std.methodcachesizeexp - 1
-        method_hash = (id(version_tag) ^ position_hash ^ hash(name)) & MASK
+        #method_hash = (id(version_tag) ^ position_hash ^ hash(name)) & MASK
+        method_hash = ((id(version_tag) >> 3) ^ hash(name)) & MASK
         cached_version_tag = ec.method_cache_versions[method_hash]
         if cached_version_tag is version_tag:
             cached_name = ec.method_cache_names[method_hash]
-            if cached_name == name:
+            if cached_name is name:
                 tup = ec.method_cache_lookup_where[method_hash]
                 if space.config.objspace.std.withmethodcachecounter:
                     ec.method_cache_hits[name] = \



More information about the Pypy-commit mailing list