Author: Carl Friedrich Bolz <[email protected]>
Branch: 
Changeset: r73660:876563a39e5b
Date: 2014-09-06 19:11 +0200
http://bitbucket.org/pypy/pypy/changeset/876563a39e5b/

Log:    up to now, malloc invalidated the cache. fix

diff --git a/rpython/translator/backendopt/storesink.py 
b/rpython/translator/backendopt/storesink.py
--- a/rpython/translator/backendopt/storesink.py
+++ b/rpython/translator/backendopt/storesink.py
@@ -95,7 +95,7 @@
             field = op.args[1].value
             clear_cache_for(cache, target.concretetype, field)
             cache[target, field] = op.args[2]
-        elif has_side_effects(op):
+        elif has_side_effects(op) and op.opname not in ("malloc", 
"malloc_varsize"):
             cache.clear()
         newops.append(op)
     return newops, added_some_same_as
diff --git a/rpython/translator/backendopt/test/test_storesink.py 
b/rpython/translator/backendopt/test/test_storesink.py
--- a/rpython/translator/backendopt/test/test_storesink.py
+++ b/rpython/translator/backendopt/test/test_storesink.py
@@ -153,3 +153,17 @@
 
         self.check(f, [int], 0)
 
+    def test_malloc_does_not_invalidate(self):
+        class A(object):
+            pass
+        class B(object):
+            pass
+
+        def f(i):
+            a = A()
+            a.x = i
+            b = B()
+            return a.x
+
+        self.check(f, [int], 0)
+
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to