[pypy-svn] r63799 - pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86

fijal at codespeak.net fijal at codespeak.net
Tue Apr 7 17:00:26 CEST 2009


Author: fijal
Date: Tue Apr  7 17:00:25 2009
New Revision: 63799

Modified:
   pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py
   pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/regalloc.py
Log:
a couple of assertions and imrpove logging


Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py	Tue Apr  7 17:00:25 2009
@@ -132,15 +132,16 @@
         else:
             args = ",".join([repr_of_arg(memo, arg) for arg in inputargs])
             os.write(self._log_fd, "LOOP %s\n" % args)
-        for op in operations:
+        for i in range(len(operations)):
+            op = operations[i]
             args = ",".join([repr_of_arg(memo, arg) for arg in op.args])
             if op.descr is not None and isinstance(op.descr, ConstDescr3):
                 descr = (str(op.descr.v[0]) + "," + str(op.descr.v[1]) +
                          "," + str(op.descr.v[2]))
-                os.write(self._log_fd, "%s %s[%s]\n" % (op.getopname(), args,
-                                                        descr))
+                os.write(self._log_fd, "%d:%s %s[%s]\n" % (i, op.getopname(),
+                                                           args, descr))
             else:
-                os.write(self._log_fd, "%s %s\n" % (op.getopname(), args))
+                os.write(self._log_fd, "%d:%s %s\n" % (i, op.getopname(), args))
             if op.result is not None:
                 os.write(self._log_fd, "  => %s\n" % repr_of_arg(memo,
                                                                  op.result))

Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/regalloc.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/regalloc.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/regalloc.py	Tue Apr  7 17:00:25 2009
@@ -299,15 +299,23 @@
                 start_live[op.result] = i
             for arg in op.args:
                 if isinstance(arg, Box):
+                    if arg not in start_live:
+                        print "Bogus arg in operation %d at %d" % (op.opnum, i)
+                        raise AssertionError
                     longevity[arg] = (start_live[arg], i)
             if op.is_guard():
                 self._compute_inpargs(op)
                 for arg in op.inputargs:
                     if isinstance(arg, Box):
+                        if arg not in start_live:
+                            print "Bogus arg in guard %d at %d" % (op.opnum, i)
+                            raise AssertionError
                         longevity[arg] = (start_live[arg], i)
         for arg in inputargs:
             if arg not in longevity:
                 longevity[arg] = (-1, -1)
+        for arg in longevity:
+            assert isinstance(arg, Box)
         self.longevity = longevity
 
     def _compute_inpargs(self, guard):
@@ -335,6 +343,10 @@
             longevity[v] = (0, e)
         guard.longevity = longevity
         guard.inputargs = end.keys()
+        for arg in longevity:
+            assert isinstance(arg, Box)
+        for arg in guard.inputargs:
+            assert isinstance(arg, Box)
 
     def try_allocate_reg(self, v, selected_reg=None):
         if isinstance(v, Const):



More information about the Pypy-commit mailing list