Author: Maciej Fijalkowski <[email protected]>
Branch: result-in-resops
Changeset: r57556:4188cc5fd3a4
Date: 2012-09-25 09:49 +0200
http://bitbucket.org/pypy/pypy/changeset/4188cc5fd3a4/

Log:    have a specific arg, just for no failargs

diff --git a/pypy/jit/tool/oparser.py b/pypy/jit/tool/oparser.py
--- a/pypy/jit/tool/oparser.py
+++ b/pypy/jit/tool/oparser.py
@@ -68,7 +68,7 @@
     use_mock_model = False
 
     def __init__(self, input, cpu, namespace, type_system, boxkinds,
-                 invent_fail_descr=True,
+                 invent_fail_descr=True, allow_no_failargs=False,
                  nonstrict=False):
         self.input = input
         self.vars = {}
@@ -82,6 +82,7 @@
             self._cache = {}
         self.invent_fail_descr = invent_fail_descr
         self.nonstrict = nonstrict
+        self.allow_no_failargs = allow_no_failargs
         self.model = get_model(self.use_mock_model)
         self.original_jitcell_token = self.model.JitCellToken()
 
@@ -250,7 +251,7 @@
             i = line.find('[', endnum) + 1
             j = line.find(']', i)
             if i <= 0 or j <= 0:
-                if not self.nonstrict:
+                if not self.nonstrict and not self.allow_no_failargs:
                     raise ParseError("missing fail_args for guard operation")
                 fail_args = None
             else:
@@ -396,11 +397,12 @@
 
 def parse(input, cpu=None, namespace=None, type_system='lltype',
           boxkinds=None, invent_fail_descr=True,
-          no_namespace=False, nonstrict=False, OpParser=OpParser):
+          no_namespace=False, nonstrict=False, OpParser=OpParser,
+          allow_no_failargs=False):
     if namespace is None and not no_namespace:
         namespace = {}
     return OpParser(input, cpu, namespace, type_system, boxkinds,
-                    invent_fail_descr, nonstrict).parse()
+                    invent_fail_descr, allow_no_failargs, nonstrict).parse()
 
 def pure_parse(*args, **kwds):
     kwds['invent_fail_descr'] = False
diff --git a/pypy/jit/tool/test/test_oparser.py 
b/pypy/jit/tool/test/test_oparser.py
--- a/pypy/jit/tool/test/test_oparser.py
+++ b/pypy/jit/tool/test/test_oparser.py
@@ -186,6 +186,14 @@
         loop = self.parse(x, nonstrict=True)
         assert not loop.operations[0].has_extra("failargs")
 
+    def test_no_fail_args_2(self):
+        x = '''
+        [i0]
+        guard_true(i0, descr=<Guard0>)
+        '''
+        loop = self.parse(x, allow_no_failargs=True)
+        assert not loop.operations[0].has_extra("failargs")
+
     def test_no_inputargs(self):
         x = '''
         i2 = int_add(i0, i1)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to