[pypy-svn] r52225 - in pypy/branch/jit-refactoring/pypy/jit/rainbow: . test

arigo at codespeak.net arigo at codespeak.net
Thu Mar 6 18:44:33 CET 2008


Author: arigo
Date: Thu Mar  6 18:44:31 2008
New Revision: 52225

Modified:
   pypy/branch/jit-refactoring/pypy/jit/rainbow/interpreter.py
   pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_promotion.py
Log:
Test and fix.


Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/interpreter.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/interpreter.py	(original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/interpreter.py	Thu Mar  6 18:44:31 2008
@@ -248,8 +248,6 @@
                 assert result is None
 
     def dispatch(self):
-        is_portal = self.frame.bytecode.is_portal
-        graph_color = self.frame.bytecode.graph_color
         frame = self.frame
         queue = self.queue
         while 1:
@@ -257,6 +255,8 @@
             resumepoint = rtimeshift.getresumepoint(newjitstate)
             self.newjitstate(newjitstate)
             if resumepoint == -1:
+                is_portal = frame.bytecode.is_portal
+                graph_color = frame.bytecode.graph_color
                 if graph_color == "gray":
                     assert not is_portal
                     newjitstate = rtimeshift.leave_graph_gray(queue)

Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_promotion.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_promotion.py	(original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_promotion.py	Thu Mar  6 18:44:31 2008
@@ -423,6 +423,23 @@
         assert res == 6
         self.check_insns(int_add=0)
 
+    def test_more_promote_in_yellow_call(self):
+        def ll_two(n):
+            n = hint(n, promote=True)
+            return n + 2
+            
+        def ll_function(n):
+            hint(None, global_merge_point=True)
+            if n > 5:
+                c = n
+            else:
+                c = ll_two(n)
+            return hint(c, variable=True)
+
+        res = self.interpret(ll_function, [4], [], policy=P_NOVIRTUAL)
+        assert res == 6
+        self.check_insns(int_add=0)
+
     def test_two_promotions_in_call(self):
         def ll_two(n, m):
             if n < 1:



More information about the Pypy-commit mailing list