[pypy-commit] pypy jitframe-on-heap: pretty crucial fix

fijal noreply at buildbot.pypy.org
Thu Jan 17 17:55:32 CET 2013


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: jitframe-on-heap
Changeset: r60135:996aae6e0891
Date: 2013-01-17 18:52 +0200
http://bitbucket.org/pypy/pypy/changeset/996aae6e0891/

Log:	pretty crucial fix

diff --git a/pypy/jit/backend/llsupport/regalloc.py b/pypy/jit/backend/llsupport/regalloc.py
--- a/pypy/jit/backend/llsupport/regalloc.py
+++ b/pypy/jit/backend/llsupport/regalloc.py
@@ -122,8 +122,6 @@
             rev_bindings[FmClass.get_loc_index(loc) + 1] = True
         assert size == 1
         rev_bindings[FmClass.get_loc_index(loc)] = True
-    if not gcmap:
-        return FmClass()
     gcrefs = []
     others = []
     c = 0
@@ -137,7 +135,8 @@
             gcrefs.append(item)
         c += 1
     for i in range(c, depth):
-        others.append(i)
+        if not rev_bindings[i]:
+            others.append(i)
     fm = FmClass(depth, gcrefs, others)
     for arg, loc in frame_bindings.iteritems():
         fm.bindings[arg] = loc
@@ -196,7 +195,6 @@
             newloc = self.freelist_gcrefs.pop(1, box.type)
         else:
             newloc = self.freelist_others.pop(size, box.type)
-            
         if newloc is None:
             #
             index = self.get_frame_depth()
@@ -207,23 +205,10 @@
                 testindex = self.get_loc_index(newloc)
                 assert testindex == index
             #
+
         self.bindings[box] = newloc
         return newloc
 
-    def set_binding(self, box, loc):
-        xxx
-        self.bindings[box] = loc
-        #
-        index = self.get_loc_index(loc)
-        if index < 0:
-            return
-        endindex = index + self.frame_size(box.type)
-        while len(self.used) < endindex:
-            self.used.append(False)
-        while index < endindex:
-            self.used[index] = True
-            index += 1
-
     def mark_as_free(self, box):
         try:
             loc = self.bindings[box]
diff --git a/pypy/jit/backend/x86/arch.py b/pypy/jit/backend/x86/arch.py
--- a/pypy/jit/backend/x86/arch.py
+++ b/pypy/jit/backend/x86/arch.py
@@ -48,14 +48,12 @@
     SAVED_REGISTERS = 1    # range(1, 5)
     MY_COPY_OF_REGS = 5    # range(5, 9)
     XXX
-    JITFRAME_FIXED_SIZE = 29 # 13 GPR + 16 XMM
-                             # reg, we don't save it
+    JITFRAME_FIXED_SIZE = 29 # 13 GPR + 15 XMM + one word for alignment
 else:
     # rbp + rbx + r12 + r13 + r14 + r15 + 12 extra words + return address = 19
     FRAME_FIXED_SIZE = 19
     PASS_ON_MY_FRAME = 12
-    JITFRAME_FIXED_SIZE = 29 # 13 GPR + 16 XMM
-                             # reg, we don't save it
+    JITFRAME_FIXED_SIZE = 29 # 13 GPR + 15 XMM + one word for alignment
     
 # "My copy of regs" has room for almost all registers, apart from eax and edx
 # which are used in the malloc itself.  They are:
diff --git a/pypy/jit/backend/x86/assembler.py b/pypy/jit/backend/x86/assembler.py
--- a/pypy/jit/backend/x86/assembler.py
+++ b/pypy/jit/backend/x86/assembler.py
@@ -1878,7 +1878,8 @@
                 pos = pos // WORD - GPR_REGS
                 locs.append(xmm_reg_mgr_cls.all_regs[pos])
             else:
-                i = pos // WORD - GPR_REGS - XMM_REGS
+                i = pos // WORD - JITFRAME_FIXED_SIZE
+                assert i >= 0
                 tp = inputargs[input_i].type
                 locs.append(StackLoc(i, pos, tp))
             input_i += 1
diff --git a/pypy/jit/backend/x86/regloc.py b/pypy/jit/backend/x86/regloc.py
--- a/pypy/jit/backend/x86/regloc.py
+++ b/pypy/jit/backend/x86/regloc.py
@@ -98,12 +98,15 @@
 
 class StackLoc(RawStackLoc):
     def __init__(self, position, ebp_offset, type):
+        from pypy.jit.backend.x86.arch import JITFRAME_FIXED_SIZE, WORD
+        
         # _getregkey() returns self.value; the value returned must not
         # conflict with RegLoc._getregkey().  It doesn't a bit by chance,
         # so let it fail the following assert if it no longer does.
         assert ebp_offset >= 0
         #assert not (0 <= ebp_offset < 8 + 8 * IS_X86_64)
         self.position = position
+        assert (position + JITFRAME_FIXED_SIZE) * WORD == ebp_offset
         self.value = ebp_offset
         # One of INT, REF, FLOAT
         self.type = type


More information about the pypy-commit mailing list