[pypy-svn] r65378 - pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test

fijal at codespeak.net fijal at codespeak.net
Sun May 24 05:06:19 CEST 2009


Author: fijal
Date: Sun May 24 05:06:15 2009
New Revision: 65378

Modified:
   pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/oparser.py
   pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_oparser.py
Log:
Support for descrs


Modified: pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/oparser.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/oparser.py	(original)
+++ pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/oparser.py	Sun May 24 05:06:15 2009
@@ -73,16 +73,21 @@
             return opnum, [], None
         allargs = argspec.split(",")
         args = []
+        descr = None
+        poss_descr = allargs[-1].strip()
+        if poss_descr.startswith('descr='):
+            descr = self.consts[poss_descr[len('descr='):]]
+            allargs = allargs[:-1]
         for arg in allargs:
             arg = arg.strip()
             try:
                 args.append(self.getvar(arg))
             except KeyError:
                 raise ParseError("Unknown var: %s" % arg)
-        return opnum, args, None
+        return opnum, args, descr
 
     def parse_result_op(self, line):
-        res, op = line.split("=")
+        res, op = line.split("=", 1)
         res = res.strip()
         op = op.strip()
         opnum, args, descr = self.parse_op(op)

Modified: pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_oparser.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_oparser.py	(original)
+++ pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_oparser.py	Sun May 24 05:06:15 2009
@@ -3,6 +3,7 @@
 
 from pypy.jit.metainterp.test.oparser import parse
 from pypy.jit.metainterp.resoperation import rop
+from pypy.jit.metainterp.history import AbstractDescr
 
 def test_basic_parse():
     x = """
@@ -30,3 +31,14 @@
     assert len(loop.operations) == 1
     assert len(loop.operations[0].suboperations) == 1
 
+def test_descr():
+    class Xyz(AbstractDescr):
+        pass
+    
+    x = """
+    [p0]
+    i1 = getfield_gc(p0, descr=stuff)
+    """
+    stuff = Xyz()
+    loop = parse(x, None, locals())
+    assert loop.operations[0].descr is stuff



More information about the Pypy-commit mailing list