[pypy-svn] pypy default: add the possibility to ignore the matching of arguments
antocuni
commits-noreply at bitbucket.org
Thu Apr 28 17:39:48 CEST 2011
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch:
Changeset: r43724:f4e1447c4e0c
Date: 2011-04-28 17:38 +0200
http://bitbucket.org/pypy/pypy/changeset/f4e1447c4e0c/
Log: add the possibility to ignore the matching of arguments
diff --git a/pypy/module/pypyjit/test_pypy_c/model.py b/pypy/module/pypyjit/test_pypy_c/model.py
--- a/pypy/module/pypyjit/test_pypy_c/model.py
+++ b/pypy/module/pypyjit/test_pypy_c/model.py
@@ -285,9 +285,10 @@
def match_op(self, op, (exp_opname, exp_res, exp_args, exp_descr)):
self._assert(op.name == exp_opname, "operation mismatch")
self.match_var(op.res, exp_res)
- self._assert(len(op.args) == len(exp_args), "wrong number of arguments")
- for arg, exp_arg in zip(op.args, exp_args):
- self._assert(self.match_var(arg, exp_arg), "variable mismatch: %r instead of %r" % (arg, exp_arg))
+ if exp_args != ['...']:
+ self._assert(len(op.args) == len(exp_args), "wrong number of arguments")
+ for arg, exp_arg in zip(op.args, exp_args):
+ self._assert(self.match_var(arg, exp_arg), "variable mismatch: %r instead of %r" % (arg, exp_arg))
self.match_descr(op.descr, exp_descr)
diff --git a/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py b/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
--- a/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
@@ -105,7 +105,7 @@
loop, = log.loops_by_filename(self.filepath)
assert loop.match_by_id('call_rec', """
...
- p53 = call_assembler(p35, p7, ConstPtr(ptr21), ConstPtr(ptr49), 0, ConstPtr(ptr51), -1, ConstPtr(ptr52), ConstPtr(ptr52), ConstPtr(ptr52), ConstPtr(ptr52), ConstPtr(ptr48), descr=...)
+ p53 = call_assembler(..., descr=...)
guard_not_forced(descr=...)
guard_no_exception(descr=...)
...
diff --git a/pypy/module/pypyjit/test_pypy_c/test_model.py b/pypy/module/pypyjit/test_pypy_c/test_model.py
--- a/pypy/module/pypyjit/test_pypy_c/test_model.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_model.py
@@ -251,6 +251,18 @@
"""
assert self.match(loop, expected, ignore_ops=['force_token'])
+ def test_match_dots_in_arguments(self):
+ loop = """
+ [i0]
+ i1 = int_add(0, 1)
+ jump(i4, descr=...)
+ """
+ expected = """
+ i1 = int_add(...)
+ jump(i4, descr=...)
+ """
+ assert self.match(loop, expected)
+
class TestRunPyPyC(BaseTestPyPyC):
More information about the Pypy-commit
mailing list