[pypy-commit] pypy guard-compatible: less strict terminator getter, can be improved even more

cfbolz pypy.commits at gmail.com
Sat Mar 19 06:58:23 EDT 2016


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: guard-compatible
Changeset: r83169:52d09afa52ce
Date: 2016-03-19 11:57 +0100
http://bitbucket.org/pypy/pypy/changeset/52d09afa52ce/

Log:	less strict terminator getter, can be improved even more

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
@@ -55,10 +55,20 @@
     def _get_terminator(self):
         return self.terminator
 
+    @jit.elidable_compatible()
+    def _get_terminator_if_devolved(self):
+        if isinstance(self.terminator, DevolvedDictTerminator):
+            return self.terminator
+        return None
+
     def read(self, obj, name, index):
         storageindex = self.find_map_storageindex(name, index)
         if storageindex == -1:
-            return self._get_terminator()._read_terminator(obj, name, index)
+            # XXX can improve the devolved case
+            terminator = self._get_terminator_if_devolved()
+            if terminator is not None:
+                return terminator._read_terminator(obj, name, index)
+            return None
         #if ( # XXX in the guard_compatible world the following isconstant may never be true?
         #    jit.isconstant(attr.storageindex) and
         #    jit.isconstant(obj) and


More information about the pypy-commit mailing list