[pypy-svn] r69058 - in pypy/trunk/pypy/jit/metainterp: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Sun Nov 8 12:41:36 CET 2009


Author: cfbolz
Date: Sun Nov  8 12:41:35 2009
New Revision: 69058

Modified:
   pypy/trunk/pypy/jit/metainterp/codewriter.py
   pypy/trunk/pypy/jit/metainterp/test/test_list.py
Log:
attach effects info to oopspec operations as well


Modified: pypy/trunk/pypy/jit/metainterp/codewriter.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/codewriter.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/codewriter.py	Sun Nov  8 12:41:35 2009
@@ -1240,8 +1240,8 @@
         else:
             opname = 'residual_call'
 
-        calldescr, non_void_args = self.codewriter.getcalldescr(c_func, args,
-                                                                op.result)
+        calldescr, non_void_args = self.codewriter.getcalldescr(
+            c_func, args, op.result, consider_effects_of=op)
         self.emit(opname)
         self.emit(self.get_position(calldescr))
         self.emit_varargs([c_func] + non_void_args)

Modified: pypy/trunk/pypy/jit/metainterp/test/test_list.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/test/test_list.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/test/test_list.py	Sun Nov  8 12:41:35 2009
@@ -378,8 +378,30 @@
         self.check_all_virtualized()
 
 
+
 class TestOOtype(ListTests, OOJitMixin):
     pass
 
 class TestLLtype(ListTests, LLJitMixin):
-    pass
+    def test_listops_dont_invalidate_caches(self):
+        class A(object):
+            pass
+        jitdriver = JitDriver(greens = [], reds = ['n', 'a', 'lst'])
+        def f(n):
+            a = A()
+            a.x = 1
+            if n < 1091212:
+                a.x = 2 # fool the annotator
+            lst = [n * 5, n * 10, n * 20]
+            while n > 0:
+                jitdriver.can_enter_jit(n=n, a=a, lst=lst)
+                jitdriver.jit_merge_point(n=n, a=a, lst=lst)
+                n += a.x
+                n = lst.pop()
+                lst.append(n - 10 + a.x)
+            a = lst.pop()
+            b = lst.pop()
+            return a * b
+        res = self.meta_interp(f, [37])
+        assert res == f(37)
+        self.check_loops(getfield_gc=1)



More information about the Pypy-commit mailing list