[pypy-svn] r67419 - pypy/branch/no-recompilation/pypy/jit/backend/x86/test
fijal at codespeak.net
fijal at codespeak.net
Tue Sep 1 20:15:49 CEST 2009
Author: fijal
Date: Tue Sep 1 20:15:48 2009
New Revision: 67419
Added:
pypy/branch/no-recompilation/pypy/jit/backend/x86/test/test_recompilation.py (contents, props changed)
Modified:
pypy/branch/no-recompilation/pypy/jit/backend/x86/test/test_regalloc.py
Log:
Start a new test file for recompilation tests. Since those should
work whether we do recompilation or no, they're just passing. More
to come.
Added: pypy/branch/no-recompilation/pypy/jit/backend/x86/test/test_recompilation.py
==============================================================================
--- (empty file)
+++ pypy/branch/no-recompilation/pypy/jit/backend/x86/test/test_recompilation.py Tue Sep 1 20:15:48 2009
@@ -0,0 +1,57 @@
+
+from pypy.jit.backend.x86.runner import CPU
+from pypy.jit.backend.x86.test.test_regalloc import BaseTestRegalloc
+
+class TestRecompilation(BaseTestRegalloc):
+ def test_compile_bridge_not_deeper(self):
+ ops = '''
+ [i0]
+ i1 = int_add(i0, 1)
+ i2 = int_lt(i1, 20)
+ guard_true(i2)
+ fail(i1)
+ jump(i1)
+ '''
+ loop = self.interpret(ops, [0])
+ assert self.getint(0) == 20
+ ops = '''
+ [i1]
+ i3 = int_add(i1, 1)
+ fail(i3)
+ '''
+ bridge = self.attach_bridge(ops, loop, loop.operations[-2])
+ self.cpu.set_future_value_int(0, 0)
+ op = self.cpu.execute_operations(loop)
+ assert op is bridge.operations[-1]
+ assert self.getint(0) == 21
+
+ def test_compile_bridge_deeper(self):
+ ops = '''
+ [i0]
+ i1 = int_add(i0, 1)
+ i2 = int_lt(i1, 20)
+ guard_true(i2)
+ fail(i1)
+ jump(i1)
+ '''
+ loop = self.interpret(ops, [0])
+ assert self.getint(0) == 20
+ ops = '''
+ [i1]
+ i3 = int_add(i1, 1)
+ i4 = int_add(i3, 1)
+ i5 = int_add(i4, 1)
+ i6 = int_add(i5, 1)
+ fail(i3, i4, i5, i6)
+ '''
+ bridge = self.attach_bridge(ops, loop, loop.operations[-2])
+ self.cpu.set_future_value_int(0, 0)
+ op = self.cpu.execute_operations(loop)
+ assert op is bridge.operations[-1]
+ assert self.getint(0) == 21
+ assert self.getint(1) == 22
+ assert self.getint(2) == 23
+ assert self.getint(3) == 24
+
+# def test_bridge_jump_to_other_loop(self):
+# xxx
Modified: pypy/branch/no-recompilation/pypy/jit/backend/x86/test/test_regalloc.py
==============================================================================
--- pypy/branch/no-recompilation/pypy/jit/backend/x86/test/test_regalloc.py (original)
+++ pypy/branch/no-recompilation/pypy/jit/backend/x86/test/test_regalloc.py Tue Sep 1 20:15:48 2009
@@ -268,34 +268,6 @@
self.interpret(ops, [0])
assert self.getint(0) == 20
- def test_compile_and_recompile(self):
- ops = '''
- [i0]
- i1 = int_add(i0, 1)
- i2 = int_lt(i1, 20)
- guard_true(i2)
- fail(i1)
- jump(i1)
- '''
- loop = self.interpret(ops, [0])
- assert self.getint(0) == 20
- ops = '''
- [i1]
- i3 = int_add(i1, 1)
- i4 = int_add(i3, 1)
- i5 = int_add(i4, 1)
- i6 = int_add(i5, 1)
- fail(i3, i4, i5, i6)
- '''
- bridge = self.attach_bridge(ops, loop, loop.operations[-2])
- self.cpu.set_future_value_int(0, 0)
- op = self.cpu.execute_operations(loop)
- assert op is bridge.operations[-1]
- assert self.getint(0) == 21
- assert self.getint(1) == 22
- assert self.getint(2) == 23
- assert self.getint(3) == 24
-
def test_two_loops_and_a_bridge(self):
ops = '''
[i0, i1, i2, i3]
@@ -615,7 +587,7 @@
self.interpret(ops, [])
assert not self.getptr(0, lltype.Ptr(self.S))
- def test_rewrite_constptr_in_brdige(self):
+ def test_rewrite_constptr_in_bridge(self):
ops = '''
[i0]
guard_true(i0)
More information about the Pypy-commit
mailing list