[pypy-svn] r70986 - pypy/branch/multijit/pypy/jit/metainterp/test
arigo at codespeak.net
arigo at codespeak.net
Sat Jan 30 15:59:24 CET 2010
Author: arigo
Date: Sat Jan 30 15:59:23 2010
New Revision: 70986
Added:
pypy/branch/multijit/pypy/jit/metainterp/test/test_two.py (contents, props changed)
Log:
First test.
Added: pypy/branch/multijit/pypy/jit/metainterp/test/test_two.py
==============================================================================
--- (empty file)
+++ pypy/branch/multijit/pypy/jit/metainterp/test/test_two.py Sat Jan 30 15:59:23 2010
@@ -0,0 +1,34 @@
+import py
+from pypy.rlib.jit import JitDriver
+from pypy.jit.metainterp.test.test_basic import LLJitMixin
+
+
+class TwoJitsTests:
+
+ def test_simple(self):
+ myjitdriver1 = JitDriver(greens = [], reds = ['n'])
+ def f1(n):
+ while n > 0:
+ myjitdriver1.can_enter_jit(n=n)
+ myjitdriver1.jit_merge_point(n=n)
+ n -= 10
+ return n
+ #
+ myjitdriver2 = JitDriver(greens = [], reds = ['m', 'x'])
+ def f2(m, x):
+ while m > 0:
+ myjitdriver2.can_enter_jit(m=m, x=x)
+ myjitdriver2.jit_merge_point(m=m, x=x)
+ m -= 1
+ x += 7
+ return x
+ #
+ def main(n, m, x):
+ return f1(n) * f2(m, x)
+ #
+ res = self.meta_interp(main, [78, 3, 0])
+ assert res == -2 * 21
+
+
+class TestLLtype(TwoJitsTests, LLJitMixin):
+ pass
More information about the Pypy-commit
mailing list