[pypy-commit] pypy guard-compatible: do annspecialcase for lookup after the mapdict stuff

cfbolz pypy.commits at gmail.com
Fri Mar 25 17:15:38 EDT 2016


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: guard-compatible
Changeset: r83374:a5db7ce2b186
Date: 2016-03-25 09:23 +0100
http://bitbucket.org/pypy/pypy/changeset/a5db7ce2b186/

Log:	do annspecialcase for lookup after the mapdict stuff

diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py
--- a/pypy/objspace/std/mapdict.py
+++ b/pypy/objspace/std/mapdict.py
@@ -1145,11 +1145,11 @@
 # ____________________________________________________________
 # various functions that replace objspace implementations
 
+ at objectmodel.specialize.arg_or_var(2)
 def mapdict_lookup(space, w_obj, name):
     if we_are_jitted():
         map = w_obj._get_mapdict_map_no_promote()
         if map is not None:
             return map._type_lookup(name)
-    w_type = space.type(w_obj)
-    return w_type.lookup(name)
+    return space._lookup(w_obj, name)
 
diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -323,10 +323,15 @@
         jit.promote(w_obj.__class__)
         return w_obj.getclass(self)
 
+    @specialize.arg_or_var(2)
     def lookup(self, w_obj, name):
         if self.config.objspace.std.withmapdict:
             from pypy.objspace.std.mapdict import mapdict_lookup
             return mapdict_lookup(self, w_obj, name)
+        # an indirection for the benefit of mapdict
+        return self._lookup(w_obj, name)
+
+    def _lookup(self, w_obj, name):
         w_type = self.type(w_obj)
         return w_type.lookup(name)
     lookup._annspecialcase_ = 'specialize:lookup'


More information about the pypy-commit mailing list