Author: Hakan Ardo <[email protected]>
Branch: jit-refactor-tests
Changeset: r48952:5b50039bad35
Date: 2011-11-08 16:39 +0100
http://bitbucket.org/pypy/pypy/changeset/5b50039bad35/
Log: convreted tests
diff --git a/pypy/jit/metainterp/test/test_del.py
b/pypy/jit/metainterp/test/test_del.py
--- a/pypy/jit/metainterp/test/test_del.py
+++ b/pypy/jit/metainterp/test/test_del.py
@@ -20,12 +20,12 @@
n -= 1
return 42
self.meta_interp(f, [20])
- self.check_loops({'call': 2, # calls to a helper function
- 'guard_no_exception': 2, # follows the calls
- 'int_sub': 1,
- 'int_gt': 1,
- 'guard_true': 1,
- 'jump': 1})
+ self.check_resops({'call': 4, # calls to a helper function
+ 'guard_no_exception': 4, # follows the calls
+ 'int_sub': 2,
+ 'int_gt': 2,
+ 'guard_true': 2,
+ 'jump': 2})
def test_class_of_allocated(self):
myjitdriver = JitDriver(greens = [], reds = ['n', 'x'])
@@ -78,7 +78,7 @@
return 1
res = self.meta_interp(f, [20], enable_opts='')
assert res == 1
- self.check_loops(call=1) # for the case B(), but not for the case A()
+ self.check_resops(call=1) # for the case B(), but not for the case
A()
class TestLLtype(DelTests, LLJitMixin):
@@ -103,7 +103,7 @@
break
return 42
self.meta_interp(f, [20])
- self.check_loops(getfield_raw=1, setfield_raw=1, call=0, call_pure=0)
+ self.check_resops(call_pure=0, setfield_raw=2, call=0, getfield_raw=2)
class TestOOtype(DelTests, OOJitMixin):
def setup_class(cls):
diff --git a/pypy/jit/metainterp/test/test_dict.py
b/pypy/jit/metainterp/test/test_dict.py
--- a/pypy/jit/metainterp/test/test_dict.py
+++ b/pypy/jit/metainterp/test/test_dict.py
@@ -91,7 +91,7 @@
res1 = f(100)
res2 = self.meta_interp(f, [100], listops=True)
assert res1 == res2
- self.check_loops(int_mod=1) # the hash was traced and eq, but cached
+ self.check_resops(int_mod=2) # the hash was traced and eq, but cached
def test_dict_setdefault(self):
myjitdriver = JitDriver(greens = [], reds = ['total', 'dct'])
@@ -107,7 +107,7 @@
assert f(100) == 50
res = self.meta_interp(f, [100], listops=True)
assert res == 50
- self.check_loops(new=0, new_with_vtable=0)
+ self.check_resops(new=0, new_with_vtable=0)
def test_dict_as_counter(self):
myjitdriver = JitDriver(greens = [], reds = ['total', 'dct'])
@@ -128,7 +128,7 @@
assert f(100) == 50
res = self.meta_interp(f, [100], listops=True)
assert res == 50
- self.check_loops(int_mod=1) # key + eq, but cached
+ self.check_resops(int_mod=2) # key + eq, but cached
def test_repeated_lookup(self):
myjitdriver = JitDriver(greens = [], reds = ['n', 'd'])
@@ -153,12 +153,13 @@
res = self.meta_interp(f, [100], listops=True)
assert res == f(50)
- self.check_loops({"call": 5, "getfield_gc": 1, "getinteriorfield_gc":
1,
- "guard_false": 1, "guard_no_exception": 4,
- "guard_true": 1, "int_and": 1, "int_gt": 1,
- "int_is_true": 1, "int_sub": 1, "jump": 1,
- "new_with_vtable": 1, "new": 1, "new_array": 1,
- "setfield_gc": 3, })
+ self.check_resops({'new_array': 2, 'getfield_gc': 2,
+ 'guard_true': 2, 'jump': 2,
+ 'new_with_vtable': 2, 'getinteriorfield_gc': 2,
+ 'setfield_gc': 6, 'int_gt': 2, 'int_sub': 2,
+ 'call': 10, 'int_and': 2,
+ 'guard_no_exception': 8, 'new': 2,
+ 'guard_false': 2, 'int_is_true': 2})
class TestOOtype(DictTests, OOJitMixin):
diff --git a/pypy/jit/metainterp/test/test_fficall.py
b/pypy/jit/metainterp/test/test_fficall.py
--- a/pypy/jit/metainterp/test/test_fficall.py
+++ b/pypy/jit/metainterp/test/test_fficall.py
@@ -68,23 +68,23 @@
'byval': False}
supported = all(d[check] for check in jitif)
if supported:
- self.check_loops(
- call_release_gil=1, # a CALL_RELEASE_GIL, and no other CALLs
+ self.check_resops(
+ call_release_gil=2, # a CALL_RELEASE_GIL, and no other CALLs
call=0,
call_may_force=0,
- guard_no_exception=1,
- guard_not_forced=1,
- int_add=1,
- int_lt=1,
- guard_true=1,
- jump=1)
+ guard_no_exception=2,
+ guard_not_forced=2,
+ int_add=2,
+ int_lt=2,
+ guard_true=2,
+ jump=2)
else:
- self.check_loops(
+ self.check_resops(
call_release_gil=0, # no CALL_RELEASE_GIL
- int_add=1,
- int_lt=1,
- guard_true=1,
- jump=1)
+ int_add=2,
+ int_lt=2,
+ guard_true=2,
+ jump=2)
return res
def test_byval_result(self):
diff --git a/pypy/jit/metainterp/test/test_greenfield.py
b/pypy/jit/metainterp/test/test_greenfield.py
--- a/pypy/jit/metainterp/test/test_greenfield.py
+++ b/pypy/jit/metainterp/test/test_greenfield.py
@@ -25,7 +25,7 @@
res = self.meta_interp(g, [7])
assert res == -2
self.check_loop_count(2)
- self.check_loops(guard_value=0)
+ self.check_resops(guard_value=0)
def test_green_field_2(self):
myjitdriver = JitDriver(greens=['ctx.x'], reds=['ctx'])
@@ -50,7 +50,7 @@
res = self.meta_interp(g, [7])
assert res == -22
self.check_loop_count(6)
- self.check_loops(guard_value=0)
+ self.check_resops(guard_value=0)
class TestLLtypeGreenFieldsTests(GreenFieldsTests, LLJitMixin):
diff --git a/pypy/jit/metainterp/test/test_jitdriver.py
b/pypy/jit/metainterp/test/test_jitdriver.py
--- a/pypy/jit/metainterp/test/test_jitdriver.py
+++ b/pypy/jit/metainterp/test/test_jitdriver.py
@@ -88,7 +88,7 @@
assert res == loop2(4, 40)
# we expect only one int_sub, corresponding to the single
# compiled instance of loop1()
- self.check_loops(int_sub=1)
+ self.check_resops(int_sub=2)
# the following numbers are not really expectations of the test
# itself, but just the numbers that we got after looking carefully
# at the generated machine code
@@ -154,7 +154,7 @@
res = self.meta_interp(loop2, [4, 40], repeat=7, inline=True)
assert res == loop2(4, 40)
# we expect no int_sub, but a residual call
- self.check_loops(int_sub=0, call=1)
+ self.check_resops(call=2, int_sub=0)
def test_multiple_jits_trace_too_long(self):
myjitdriver1 = JitDriver(greens=["n"], reds=["i", "box"])
diff --git a/pypy/jit/metainterp/test/test_list.py
b/pypy/jit/metainterp/test/test_list.py
--- a/pypy/jit/metainterp/test/test_list.py
+++ b/pypy/jit/metainterp/test/test_list.py
@@ -6,8 +6,8 @@
class ListTests:
def check_all_virtualized(self):
- self.check_loops(new_array=0, setarrayitem_gc=0, getarrayitem_gc=0,
- arraylen_gc=0)
+ self.check_resops(setarrayitem_gc=0, new_array=0, arraylen_gc=0,
+ getarrayitem_gc=0)
def test_simple_array(self):
jitdriver = JitDriver(greens = [], reds = ['n'])
@@ -20,7 +20,7 @@
return n
res = self.meta_interp(f, [10], listops=True)
assert res == 0
- self.check_loops(int_sub=1)
+ self.check_resops(int_sub=2)
self.check_all_virtualized()
def test_list_pass_around(self):
@@ -56,7 +56,8 @@
res = self.meta_interp(f, [10], listops=True)
assert res == f(10)
# one setitem should be gone by now
- self.check_loops(call=1, setarrayitem_gc=2, getarrayitem_gc=1)
+ self.check_resops(setarrayitem_gc=4, getarrayitem_gc=2, call=2)
+
def test_ll_fixed_setitem_fast(self):
jitdriver = JitDriver(greens = [], reds = ['n', 'l'])
@@ -93,7 +94,7 @@
res = self.meta_interp(f, [10], listops=True)
assert res == f(10)
- self.check_loops(setarrayitem_gc=0, getarrayitem_gc=0, call=0)
+ self.check_resops(setarrayitem_gc=0, call=0, getarrayitem_gc=0)
def test_vlist_alloc_and_set(self):
# the check_loops fails, because [non-null] * n is not supported yet
@@ -141,7 +142,7 @@
res = self.meta_interp(f, [5], listops=True)
assert res == 7
- self.check_loops(call=0)
+ self.check_resops(call=0)
def test_fold_getitem_1(self):
jitdriver = JitDriver(greens = ['pc', 'n', 'l'], reds = ['total'])
@@ -161,7 +162,7 @@
res = self.meta_interp(f, [4], listops=True)
assert res == f(4)
- self.check_loops(call=0)
+ self.check_resops(call=0)
def test_fold_getitem_2(self):
jitdriver = JitDriver(greens = ['pc', 'n', 'l'], reds = ['total', 'x'])
@@ -186,7 +187,7 @@
res = self.meta_interp(f, [4], listops=True)
assert res == f(4)
- self.check_loops(call=0, getfield_gc=0)
+ self.check_resops(call=0, getfield_gc=0)
def test_fold_indexerror(self):
jitdriver = JitDriver(greens = [], reds = ['total', 'n', 'lst'])
@@ -206,7 +207,7 @@
res = self.meta_interp(f, [15], listops=True)
assert res == f(15)
- self.check_loops(guard_exception=0)
+ self.check_resops(guard_exception=0)
def test_virtual_resize(self):
jitdriver = JitDriver(greens = [], reds = ['n', 's'])
@@ -224,9 +225,8 @@
return s
res = self.meta_interp(f, [15], listops=True)
assert res == f(15)
- self.check_loops({"int_add": 1, "int_sub": 1, "int_gt": 1,
- "guard_true": 1, "jump": 1})
-
+ self.check_resops({'jump': 2, 'int_gt': 2, 'int_add': 2,
+ 'guard_true': 2, 'int_sub': 2})
class TestOOtype(ListTests, OOJitMixin):
pass
@@ -258,4 +258,4 @@
assert res == f(37)
# There is the one actual field on a, plus several fields on the list
# itself
- self.check_loops(getfield_gc=10, everywhere=True)
+ self.check_resops(getfield_gc=10)
diff --git a/pypy/jit/metainterp/test/test_slist.py
b/pypy/jit/metainterp/test/test_slist.py
--- a/pypy/jit/metainterp/test/test_slist.py
+++ b/pypy/jit/metainterp/test/test_slist.py
@@ -76,7 +76,7 @@
return lst[i]
res = self.meta_interp(f, [21], listops=True)
assert res == f(21)
- self.check_loops(call=0)
+ self.check_resops(call=0)
def test_getitem_neg(self):
myjitdriver = JitDriver(greens = [], reds = ['i', 'n'])
@@ -92,7 +92,7 @@
return x
res = self.meta_interp(f, [-2], listops=True)
assert res == 41
- self.check_loops(call=0, guard_value=0)
+ self.check_resops(call=0, guard_value=0)
# we don't support resizable lists on ootype
#class TestOOtype(ListTests, OOJitMixin):
diff --git a/pypy/jit/metainterp/test/test_tl.py
b/pypy/jit/metainterp/test/test_tl.py
--- a/pypy/jit/metainterp/test/test_tl.py
+++ b/pypy/jit/metainterp/test/test_tl.py
@@ -72,16 +72,16 @@
res = self.meta_interp(main, [0, 6], listops=True,
backendopt=True)
assert res == 5040
- self.check_loops({'int_mul':1, 'jump':1,
- 'int_sub':1, 'int_le':1, 'guard_false':1})
+ self.check_resops({'jump': 2, 'int_le': 2, 'guard_value': 1,
+ 'int_mul': 2, 'guard_false': 2, 'int_sub': 2})
def test_tl_2(self):
main = self._get_main()
res = self.meta_interp(main, [1, 10], listops=True,
backendopt=True)
assert res == main(1, 10)
- self.check_loops({'int_sub':1, 'int_le':1,
- 'guard_false':1, 'jump':1})
+ self.check_resops({'int_le': 2, 'int_sub': 2, 'jump': 2,
+ 'guard_false': 2, 'guard_value': 1})
def test_tl_call(self, listops=True, policy=None):
from pypy.jit.tl.tl import interp
diff --git a/pypy/jit/metainterp/test/test_warmspot.py
b/pypy/jit/metainterp/test/test_warmspot.py
--- a/pypy/jit/metainterp/test/test_warmspot.py
+++ b/pypy/jit/metainterp/test/test_warmspot.py
@@ -103,12 +103,12 @@
# check that the set_param will override the default
res = self.meta_interp(f, [10, llstr('')])
assert res == 0
- self.check_loops(new_with_vtable=1)
+ self.check_resops(new_with_vtable=1)
res = self.meta_interp(f, [10, llstr(ALL_OPTS_NAMES)],
enable_opts='')
assert res == 0
- self.check_loops(new_with_vtable=0)
+ self.check_resops(new_with_vtable=0)
def test_unwanted_loops(self):
mydriver = JitDriver(reds = ['n', 'total', 'm'], greens = [])
@@ -163,7 +163,7 @@
return n
self.meta_interp(f, [50], backendopt=True)
self.check_enter_count_at_most(2)
- self.check_loops(call=0)
+ self.check_resops(call=0)
def test_loop_header(self):
# artificial test: we enter into the JIT only when can_enter_jit()
@@ -187,7 +187,7 @@
assert f(15) == 1
res = self.meta_interp(f, [15], backendopt=True)
assert res == 1
- self.check_loops(int_add=1) # I get 13 without the loop_header()
+ self.check_resops(int_add=2) # I get 13 without the loop_header()
def test_omit_can_enter_jit(self):
# Simple test comparing the effects of always giving a can_enter_jit(),
@@ -249,8 +249,8 @@
m = m - 1
self.meta_interp(f1, [8])
self.check_loop_count(1)
- self.check_loops({'int_sub': 1, 'int_gt': 1, 'guard_true': 1,
- 'jump': 1})
+ self.check_resops({'jump': 2, 'guard_true': 2, 'int_gt': 2,
+ 'int_sub': 2})
def test_void_red_variable(self):
mydriver = JitDriver(greens=[], reds=['a', 'm'])
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit