[pypy-svn] r53675 - in pypy/branch/jit-hotpath/pypy/jit/rainbow: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Apr 10 21:26:43 CEST 2008


Author: cfbolz
Date: Thu Apr 10 21:26:40 2008
New Revision: 53675

Modified:
   pypy/branch/jit-hotpath/pypy/jit/rainbow/fallback.py
   pypy/branch/jit-hotpath/pypy/jit/rainbow/interpreter.py
   pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_hp_vlist.py
   pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_interpreter.py
   pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_vlist.py
Log:
dummy commit to test commit hook


Modified: pypy/branch/jit-hotpath/pypy/jit/rainbow/fallback.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/rainbow/fallback.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/rainbow/fallback.py	Thu Apr 10 21:26:40 2008
@@ -66,7 +66,8 @@
             # if shapemask != -1 in store_back_virtualizables(), we should
             # not reach this point before we reach the "State sanitized" line.
             reshaping = content in self.containers_needing_reshaping
-            gv_result = content.allocate_gv_container(self.rgenop, reshaping)
+            gv_result = content.allocate_gv_container(
+                self.rgenop, self.getinitialboxgv, reshaping)
             self.containers_gv[content] = gv_result
             content.populate_gv_container(self.rgenop, gv_result,
                                           self.getinitialboxgv)

Modified: pypy/branch/jit-hotpath/pypy/jit/rainbow/interpreter.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/rainbow/interpreter.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/rainbow/interpreter.py	Thu Apr 10 21:26:40 2008
@@ -1052,6 +1052,7 @@
         self.opcode_descs.append(opdesc)
         return index
 
+
 class LLTypeJitInterpreter(JitInterpreter):
     ts = typesystem.llhelper
 

Modified: pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_hp_vlist.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_hp_vlist.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_hp_vlist.py	Thu Apr 10 21:26:40 2008
@@ -242,6 +242,32 @@
         self.check_insns_in_loops({'int_rshift': 1, 'int_add': 1,
                                    'int_is_true': 1})
 
+    def test_beginning_of_list(self):
+        class MyJitDriver(JitDriver):
+            greens = []
+            reds = ['lst', 'i', 'result']
+            def on_enter_jit(self, invariants, reds):
+                reds.lst = list(reds.lst)
+        myjitdriver = MyJitDriver()
+        def f(x):
+            lst = [x]
+            i = x
+            result = 0
+            while i:
+                i -= 1
+                result += lst.pop()
+                lst.append(result)
+                lst.append(result)
+                myjitdriver.jit_merge_point(lst=lst, result=result, i=i)
+                myjitdriver.can_enter_jit(lst=lst, result=result, i=i)
+            return result + len(lst)
+                
+        res = self.run(f, [10], threshold=2, policy=P_OOPSPEC)
+        assert res == f(10)
+        # XXX fails due to merging problems
+        #self.check_insns(int_is_true=2, int_sub=2) # made a second loop
+
+
     def test_bogus_index_while_compiling(self):
         py.test.skip("implement me")
         class Y:

Modified: pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_interpreter.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_interpreter.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_interpreter.py	Thu Apr 10 21:26:40 2008
@@ -80,7 +80,7 @@
              for v in graph1.getargs()])
     hannotator.simplify()
     if conftest.option.view:
-        hannotator.translator.view()
+        hannotator.translator.viewcg()
     return hs, hannotator, rtyper
 
 

Modified: pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_vlist.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_vlist.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_vlist.py	Thu Apr 10 21:26:40 2008
@@ -158,6 +158,56 @@
         assert res == -42
         self.check_insns({})
 
+    def test_beginning_of_list(self):
+        def f(x):
+            lst = [x]
+            i = x
+            result = 0
+            while i:
+                i -= 1
+                result += lst.pop()
+                lst.append(result)
+                lst.append(result)
+            return result + len(lst)
+                
+        res = self.interpret(f, [10], policy=P_OOPSPEC)
+        assert res == f(10)
+        self.check_insns(int_is_true=2, int_sub=2) # made a second loop
+        # the following calls are generated:
+        # 1 newlist
+        # 1 resize
+        # 2 setitems
+        # 2 length
+        #self.check_insns(direct_call=6) # how does the check work in ootype? XXX
+
+    def test_beginning_of_list_operations(self):
+        def f(x):
+            lst = [x, x, 1]
+            i = x
+            result = 0
+            while i:
+                i -= 1
+                one = lst.pop()
+                assert one == 1
+                result += lst.pop() + lst[-1]
+                lst.append(result)
+                lst.append(result)
+                lst[-2] = 14
+                lst.append(42)
+                del lst[-1]
+                lst.append(bool(lst))
+            return result + len(lst)
+                
+        res = self.interpret(f, [10], policy=P_OOPSPEC)
+        assert res == f(10)
+        self.check_insns(int_is_true=2, int_sub=2) # made a second loop
+        # the following calls are generated:
+        # 1 newlist
+        # 1 resize
+        # 2 setitems
+        # 2 length
+        #self.check_insns(direct_call=6) # how does the check work in ootype? XXX
+
     def test_bogus_index_while_compiling(self):
         py.test.skip("implement me")
         class Y:
@@ -189,8 +239,8 @@
         assert res == -7
 
 
-class TestOOType(VListTest):
-    type_system = "ootype"
-
 class TestLLType(VListTest):
     type_system = "lltype"
+
+class TestOOType(VListTest):
+    type_system = "ootype"



More information about the Pypy-commit mailing list