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

cfbolz at codespeak.net cfbolz at codespeak.net
Sun Mar 2 16:12:54 CET 2008


Author: cfbolz
Date: Sun Mar  2 16:12:52 2008
New Revision: 52041

Modified:
   pypy/branch/jit-refactoring/pypy/jit/rainbow/codewriter.py
   pypy/branch/jit-refactoring/pypy/jit/rainbow/interpreter.py
   pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_interpreter.py
Log:
support the portal returning green stuff


Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/codewriter.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/codewriter.py	(original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/codewriter.py	Sun Mar  2 16:12:52 2008
@@ -348,7 +348,15 @@
         if block.exits == ():
             returnvar, = block.inputargs
             color = self.graph_calling_color(self.graph)
-            if color == "red":
+            if self.is_portal:
+                if color == "yellow":
+                    place = self.serialize_oparg("red", returnvar)
+                    assert place == 0
+                if color == "gray":
+                    self.emit("gray_return")
+                else:
+                    self.emit("red_return")
+            elif color == "red":
                 self.emit("red_return")
             elif color == "gray":
                 self.emit("gray_return")

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	Sun Mar  2 16:12:52 2008
@@ -256,16 +256,16 @@
         resumepoint = rtimeshift.getresumepoint(newjitstate)
         self.newjitstate(newjitstate)
         if resumepoint == -1:
-            if graph_color == "red":
+            if graph_color == "gray":
+                assert not is_portal
+                newjitstate = rtimeshift.leave_graph_gray(queue)
+            elif is_portal or graph_color == "red":
                 newjitstate = rtimeshift.leave_graph_red(
                         queue, is_portal)
             elif graph_color == "yellow":
                 newjitstate = rtimeshift.leave_graph_yellow(queue)
             elif graph_color == "green":
                 assert 0, "green graphs shouldn't be seen by the rainbow interp"
-            elif graph_color == "gray":
-                assert not is_portal
-                newjitstate = rtimeshift.leave_graph_gray(queue)
             else:
                 assert 0, "unknown graph color %s" % (graph_color, )
 

Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_interpreter.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_interpreter.py	(original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_interpreter.py	Sun Mar  2 16:12:52 2008
@@ -251,7 +251,6 @@
     small = True
 
     def test_simple_fixed(self):
-        py.test.skip("green return")
         def ll_function(x, y):
             return hint(x + y, concrete=True)
         res = self.interpret(ll_function, [5, 7])
@@ -452,7 +451,6 @@
         assert res == ll_function(-70)
 
     def test_merge_const_at_return(self):
-        py.test.skip("green return")
         def ll_function(x):
             if x > 0:
                 return 17



More information about the Pypy-commit mailing list