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

cfbolz at codespeak.net cfbolz at codespeak.net
Sun Mar 2 19:08:21 CET 2008


Author: cfbolz
Date: Sun Mar  2 19:08:18 2008
New Revision: 52063

Modified:
   pypy/branch/jit-refactoring/pypy/jit/rainbow/interpreter.py
   pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_portal.py
   pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_promotion.py
Log:
fix a bug with dispatching logic: if a callee is done, it must continue
dispatching in the caller, obviously. This only showed when the caller still
had stuff to do and the callee did a promote.


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 19:08:18 2008
@@ -250,29 +250,37 @@
     def dispatch(self):
         is_portal = self.frame.bytecode.is_portal
         graph_color = self.frame.bytecode.graph_color
+        frame = self.frame
         queue = self.queue
-        newjitstate = rtimeshift.dispatch_next(queue)
-        resumepoint = rtimeshift.getresumepoint(newjitstate)
-        self.newjitstate(newjitstate)
-        if resumepoint == -1:
-            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"
-            else:
-                assert 0, "unknown graph color %s" % (graph_color, )
-
+        while 1:
+            newjitstate = rtimeshift.dispatch_next(queue)
+            resumepoint = rtimeshift.getresumepoint(newjitstate)
             self.newjitstate(newjitstate)
-            if self.frame is None:
-                return STOP
-        else:
-            self.frame.pc = resumepoint
+            if resumepoint == -1:
+                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"
+                else:
+                    assert 0, "unknown graph color %s" % (graph_color, )
+
+                self.newjitstate(newjitstate)
+                if self.frame is None:
+                    if frame.backframe is not None:
+                        import pdb; pdb.set_trace()
+                        frame = frame.backframe
+                        queue = frame.dispatchqueue
+                        continue
+                    return STOP
+            else:
+                self.frame.pc = resumepoint
+            return
 
     # operation helper functions
     def load_byte(self):

Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_portal.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_portal.py	(original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_portal.py	Sun Mar  2 19:08:18 2008
@@ -528,7 +528,6 @@
         res = self.timeshift_from_portal(f, g, [42], policy=P_NOVIRTUAL)
 
     def test_recursive_portal_call(self):
-        py.test.skip("not working yet")
         def indirection(green, red):
             newgreen = hint((green + red) % 100, promote=True)
             return portal(newgreen, red + 1)

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	Sun Mar  2 19:08:18 2008
@@ -101,11 +101,10 @@
         self.check_insns(int_add=1, int_mul=0, int_sub=0)
 
     def test_promote_inside_call2(self):
-        py.test.skip("bug in promotion")
         def ll_two(n):
             k = hint(n, promote=True)
             k *= 17
-            return hint(k, variable=True)
+            return k
         def ll_function(n, m):
             hint(None, global_merge_point=True)
             if not n:


More information about the pypy-svn mailing list