[pypy-commit] pypy unroll-if-alt: only unroll the adding of an attribute when the map and the attribute names are constant.

cfbolz noreply at buildbot.pypy.org
Tue Aug 2 12:39:25 CEST 2011


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: unroll-if-alt
Changeset: r46190:4fd7b839acd2
Date: 2011-08-02 12:40 +0200
http://bitbucket.org/pypy/pypy/changeset/4fd7b839acd2/

Log:	only unroll the adding of an attribute when the map and the
	attribute names are constant.

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
@@ -132,7 +132,10 @@
             cache[selector] = attr
         return attr
 
-    @jit.unroll_safe
+    @jit.unroll_if(lambda self, obj, selector, w_value:
+            jit.isconstant(self) and
+            jit.isconstant(selector[0]) and
+            jit.isconstant(selector[1]))
     def add_attr(self, obj, selector, w_value):
         # grumble, jit needs this
         attr = self._get_new_attr(selector[0], selector[1])


More information about the pypy-commit mailing list