[pypy-svn] r51235 - in pypy/branch/jit-refactoring/pypy/jit: rainbow rainbow/test timeshifter/test
cfbolz at codespeak.net
cfbolz at codespeak.net
Mon Feb 4 10:03:35 CET 2008
Author: cfbolz
Date: Mon Feb 4 10:03:34 2008
New Revision: 51235
Modified:
pypy/branch/jit-refactoring/pypy/jit/rainbow/bytecode.py
pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_interpreter.py
pypy/branch/jit-refactoring/pypy/jit/timeshifter/test/test_timeshift.py
Log:
move test_recursive_call over from test_timeshift and make it pass.
Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/bytecode.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/bytecode.py (original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/bytecode.py Mon Feb 4 10:03:34 2008
@@ -100,7 +100,7 @@
assert 0, "unknown graph color %s" % (graph_color, )
self.newjitstate(newjitstate)
- if newjitstate is None or is_portal:
+ if self.frame is None:
return STOP
else:
self.frame.pc = resumepoint
@@ -606,12 +606,15 @@
def graph_position(self, graph):
if graph in self.graph_positions:
return self.graph_positions[graph]
- bytecode = JitCode.__new__(JitCode)
+ if graph in self.all_graphs:
+ bytecode = self.all_graphs[graph]
+ else:
+ bytecode = JitCode.__new__(JitCode)
+ self.all_graphs[graph] = bytecode
+ self.unfinished_graphs.append(graph)
index = len(self.called_bytecodes)
self.called_bytecodes.append(bytecode)
- self.all_graphs[graph] = bytecode
self.graph_positions[graph] = index
- self.unfinished_graphs.append(graph)
return index
def nonrainbow_position(self, fnptr):
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 Mon Feb 4 10:03:34 2008
@@ -488,5 +488,16 @@
assert res == 23
self.check_insns({'int_gt': 1})
+ def test_recursive_call(self):
+ def ll_pseudo_factorial(n, fudge):
+ k = hint(n, concrete=True)
+ if n <= 0:
+ return 1
+ return n * ll_pseudo_factorial(n - 1, fudge + n) - fudge
+ res = self.interpret(ll_pseudo_factorial, [4, 2], [0])
+ expected = ll_pseudo_factorial(4, 2)
+ assert res == expected
+
+
class TestLLType(SimpleTests):
type_system = "lltype"
Modified: pypy/branch/jit-refactoring/pypy/jit/timeshifter/test/test_timeshift.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/timeshifter/test/test_timeshift.py (original)
+++ pypy/branch/jit-refactoring/pypy/jit/timeshifter/test/test_timeshift.py Mon Feb 4 10:03:34 2008
@@ -777,16 +777,6 @@
assert res == True
self.check_insns({'setfield': 2, 'getfield': 1})
- def test_recursive_call(self):
- def ll_pseudo_factorial(n, fudge):
- k = hint(n, concrete=True)
- if n <= 0:
- return 1
- return n * ll_pseudo_factorial(n - 1, fudge + n) - fudge
- res = self.timeshift(ll_pseudo_factorial, [4, 2], [0])
- expected = ll_pseudo_factorial(4, 2)
- assert res == expected
-
def test_recursive_with_red_termination_condition(self):
py.test.skip('Does not terminate')
def ll_factorial(n):
More information about the Pypy-commit
mailing list