[pypy-svn] r63097 - in pypy/branch/pyjitpl5/pypy/jit/backend/x86: . test

arigo at codespeak.net arigo at codespeak.net
Thu Mar 19 20:17:49 CET 2009


Author: arigo
Date: Thu Mar 19 20:17:46 2009
New Revision: 63097

Modified:
   pypy/branch/pyjitpl5/pypy/jit/backend/x86/assembler.py
   pypy/branch/pyjitpl5/pypy/jit/backend/x86/regalloc.py
   pypy/branch/pyjitpl5/pypy/jit/backend/x86/runner.py
   pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_regalloc.py
Log:
Fixes to the x86 backend to handle the Const-less liveboxes.


Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/assembler.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/assembler.py	Thu Mar 19 20:17:46 2009
@@ -117,14 +117,11 @@
         if self._log_fd == -1:
             return
         os.write(self._log_fd, 'xxxxxxxxxx\n')
-        j = 0
         memo = {}
         reprs = []
-        for box in gf.guard_op.liveboxes:
-            if isinstance(box, Box):
-                valuebox = gf.cpu.getvaluebox(gf.frame, gf.guard_op, j)
-                reprs.append(repr_of_arg(memo, valuebox))
-                j += 1
+        for j in range(len(gf.guard_op.liveboxes)):
+            valuebox = gf.cpu.getvaluebox(gf.frame, gf.guard_op, j)
+            reprs.append(repr_of_arg(memo, valuebox))
         jmp = gf.guard_op._jmp_from
         os.write(self._log_fd, "%d %d %s\n" % (guard_index, jmp,
                                                ",".join(reprs)))

Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/regalloc.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/regalloc.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/regalloc.py	Thu Mar 19 20:17:46 2009
@@ -240,8 +240,8 @@
                     longevity[arg] = (start_live[arg], i)
             if op.is_guard():
                 for arg in op.liveboxes:
-                    if isinstance(arg, Box):
-                        longevity[arg] = (start_live[arg], i)
+                    assert isinstance(arg, Box)
+                    longevity[arg] = (start_live[arg], i)
         self.longevity = longevity
 
     def try_allocate_reg(self, v, selected_reg=None):
@@ -338,11 +338,11 @@
         stacklocs = []
         locs = []
         for arg in guard_op.liveboxes:
-            if isinstance(arg, Box):
-                if arg not in self.stack_bindings:
-                    self.dirty_stack[arg] = True
-                stacklocs.append(self.stack_loc(arg).position)
-                locs.append(self.loc(arg))
+            assert isinstance(arg, Box)
+            if arg not in self.stack_bindings:
+                self.dirty_stack[arg] = True
+            stacklocs.append(self.stack_loc(arg).position)
+            locs.append(self.loc(arg))
         if not we_are_translated():
             assert len(dict.fromkeys(stacklocs)) == len(stacklocs)
         guard_op.stacklocs = stacklocs

Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/runner.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/runner.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/runner.py	Thu Mar 19 20:17:46 2009
@@ -395,7 +395,7 @@
 
     def getvaluebox(self, frameadr, guard_op, argindex):
         # XXX that's plain stupid, do we care about the return value???
-        box = [b for b in guard_op.liveboxes if isinstance(b, Box)][argindex]
+        box = guard_op.liveboxes[argindex]
         frame = getframe(frameadr)
         pos = guard_op.stacklocs[argindex]
         intvalue = frame[pos]

Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_regalloc.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_regalloc.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_regalloc.py	Thu Mar 19 20:17:46 2009
@@ -246,43 +246,15 @@
                      None)
         ]
     ops[-5].descr = cpu.fielddescrof(TP, 'y')
-    ops[1].liveboxes = [ConstInt(21), const_code, p0, i11, i5, i2, i3, i4, p1,
-                        p6, p7, i8, i9, i10, p12, p13, const_name]
-    ops[3].liveboxes = [ConstInt(21), const_code, p0, ConstInt(21), i5, i2, i3,
-                        i4, p1, p6, p7, i8, i9, ConstInt(1), p12, p13,
-                        const_name, const_name, ConstInt(21),
-                        const_name, ConstInt(24), ConstInt(16), ConstInt(16),
-                        ConstInt(24), ConstInt(346), ConstInt(0)]
-    ops[5].liveboxes = [ConstInt(21), const_code, p0, ConstInt(21), i5, i2, i3,
-                        i4, p1, p6, p7, i8, i9, ConstInt(1), p12, p13,
-                        const_name, const_name, ConstInt(21), const_name,
-                        ConstInt(24), ConstInt(16), ConstInt(16),
-                        ConstInt(24), ConstInt(346), ConstInt(1)]
-    ops[7].liveboxes = [ConstInt(21), const_code, p0, ConstInt(21), i5, i2,
-                        i3, i4, p1, p6, p7, i8, i9, ConstInt(1), p12, p13,
-                        const_name, const_name, ConstInt(21), const_name,
-                        ConstInt(24), ConstInt(16), ConstInt(16),
-                        ConstInt(24), ConstInt(346), ConstInt(1)]
-    ops[9].liveboxes = [ConstInt(21), const_code, p0, ConstInt(21), i5, i2,
-                        i3, i4, p1, p6, p7, i8, i9, ConstInt(1), p12, p13,
-                        const_name, const_name, ConstInt(21), const_name,
-                        ConstInt(24), ConstInt(16), ConstInt(16),
-                        ConstInt(24), ConstInt(346), ConstInt(1)]
-    ops[14].liveboxes = [ConstInt(33), const_code, p0, ConstInt(33), i20,
-                         i2, i3, i4, p1, none_ptr, none_ptr, i8, i19,
-                         ConstInt(1), p12, p13, const_name, const_name,
-                         ConstInt(33), const_name, ConstInt(34),
-                         ConstInt(0), ConstInt(347), i21]
-    ops[17].liveboxes = [ConstInt(37), const_code, p0, ConstInt(37), i20, i2,
-                         i3, i4, p1, none_ptr, none_ptr, i21, i19,
-                         ConstInt(1), p12, p13, const_name, const_name,
-                         ConstInt(37), const_name, ConstInt(40), ConstInt(21),
-                         ConstInt(21), p22, ConstInt(1)]
-    ops[-2].liveboxes = [ConstInt(37), const_code, p0, ConstInt(37), i20, i2,
-                         i3, i4, p1, none_ptr, none_ptr, i21, i19,
-                         ConstInt(1), p12, p13, const_name, const_name,
-                         ConstInt(37), const_name, ConstInt(40), ConstInt(21),
-                         ConstInt(21), p22]
+    ops[1].liveboxes = [p0, i11, i5, i2, i3, i4, p1, p6, p7, i8,
+                        i9, i10, p12, p13]
+    ops[3].liveboxes = [p0, i5, i2, i3, i4, p1, p6, p7, i8, i9, p12, p13]
+    ops[5].liveboxes = [p0, i5, i2, i3, i4, p1, p6, p7, i8, i9, p12, p13]
+    ops[7].liveboxes = [p0, i5, i2, i3, i4, p1, p6, p7, i8, i9, p12, p13]
+    ops[9].liveboxes = [p0, i5, i2, i3, i4, p1, p6, p7, i8, i9, p12, p13]
+    ops[14].liveboxes = [p0, i20, i2, i3, i4, p1, i8, i19, p12, p13, i21]
+    ops[17].liveboxes = [p0, i20, i2, i3, i4, p1, i21, i19, p12, p13, p22]
+    ops[-2].liveboxes = [p0, i20, i2, i3, i4, p1, i21, i19, p12, p13, p22]
 
     ops[-1].jump_target = ops[0]
     cpu.compile_operations(ops)



More information about the Pypy-commit mailing list