Author: Maciej Fijalkowski <[email protected]>
Branch: result-in-resops
Changeset: r58358:b0f8a9f0cec4
Date: 2012-10-22 15:55 +0200
http://bitbucket.org/pypy/pypy/changeset/b0f8a9f0cec4/

Log:    start hacking. pass test_resoperation at least

diff --git a/pypy/jit/backend/llgraph/runner.py 
b/pypy/jit/backend/llgraph/runner.py
--- a/pypy/jit/backend/llgraph/runner.py
+++ b/pypy/jit/backend/llgraph/runner.py
@@ -22,6 +22,11 @@
         # We need to clone the list of operations because the
         # front-end will mutate them under our feet again.  We also
         # need to make sure things get freed.
+
+        # XXX for now
+        self.operations = operations
+        self.inputargs = inputargs
+        return
         def mapping(box, _cache={}):
             if isinstance(box, Const) or box is None:
                 return box
@@ -673,22 +678,19 @@
                     self.do_renaming(self.lltrace.inputargs, newargs)
                     continue
                 raise
-            if op.result is not None:
+            if op.type == INT:
                 # typecheck the result
-                if op.result.type == INT:
-                    if isinstance(resval, bool):
-                        resval = int(resval)
-                    assert lltype.typeOf(resval) == lltype.Signed
-                elif op.result.type == REF:
-                    assert lltype.typeOf(resval) == llmemory.GCREF
-                elif op.result.type == FLOAT:
-                    assert lltype.typeOf(resval) == longlong.FLOATSTORAGE
-                else:
-                    raise AssertionError(op.result.type)
-                #
-                self.env[op.result] = resval
+                if isinstance(resval, bool):
+                    resval = int(resval)
+                assert lltype.typeOf(resval) == lltype.Signed
+            elif op.type == REF:
+                assert lltype.typeOf(resval) == llmemory.GCREF
+            elif op.type == FLOAT:
+                assert lltype.typeOf(resval) == longlong.FLOATSTORAGE
             else:
+                assert op.type == VOID
                 assert resval is None
+            self.env[op] = resval
             i += 1
 
     def _getfailargs(self, op=None, skip=None):
@@ -919,9 +921,10 @@
 
 def _getdescr(op):
     d = op.getdescr()
-    if d is not None:
-        d = d.realdescrref()
-        assert d is not None, "the descr disappeared: %r" % (op,)
+    # XXX for now
+    #if d is not None:
+    #    d = d.realdescrref()
+    #    assert d is not None, "the descr disappeared: %r" % (op,)
     return d
 
 def _setup():
diff --git a/pypy/jit/metainterp/resoperation.py 
b/pypy/jit/metainterp/resoperation.py
--- a/pypy/jit/metainterp/resoperation.py
+++ b/pypy/jit/metainterp/resoperation.py
@@ -498,7 +498,7 @@
     def __hash__(self):
         import sys
         co_fname = sys._getframe(1).f_code.co_filename
-        if co_fname.endswith('resume.py') or 
co_fname.endswith('optimizeopt/util.py'):
+        if co_fname.endswith('resume.py') or 
co_fname.endswith('optimizeopt/util.py') or 'backend/llgraph' in co_fname:
             return object.__hash__(self)
         raise Exception("Should not hash resops, use get/set extra instead")
 
@@ -1393,7 +1393,7 @@
     }
 
     is_guard = name.startswith('GUARD')
-    if is_guard or name == 'FINISH':
+    if is_guard:
         baseclass = GuardResOp
     elif withdescr:
         baseclass = ResOpWithDescr
diff --git a/pypy/jit/metainterp/test/test_resoperation.py 
b/pypy/jit/metainterp/test/test_resoperation.py
--- a/pypy/jit/metainterp/test/test_resoperation.py
+++ b/pypy/jit/metainterp/test/test_resoperation.py
@@ -135,8 +135,8 @@
     assert ope._get_hash_() == op._get_hash_()
     assert ope.eq(op)
 
-    op = rop.create_resop_0(rop.rop.FORCE_TOKEN, 13)
-    op1 = rop.create_resop_0(rop.rop.FORCE_TOKEN, 15)
+    op = rop.create_resop_0(rop.rop.INPUT_i, 13)
+    op1 = rop.create_resop_0(rop.rop.INPUT_i, 15)
     assert op._get_hash_() != op1._get_hash_()
     assert not op.eq(op1)
     S = lltype.GcStruct('S')
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to