Author: Maciej Fijalkowski <[email protected]>
Branch: jitframe-on-heap
Changeset: r60302:bd2e2eb96f1f
Date: 2013-01-21 19:53 +0200
http://bitbucket.org/pypy/pypy/changeset/bd2e2eb96f1f/

Log:    oops

diff --git a/rpython/jit/backend/llsupport/regalloc.py 
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -18,6 +18,9 @@
         self.val = val
         self.next = next
 
+    def __repr__(self):
+        return '<Node %d %r>' % (self.val, next)
+
 class LinkedList(object):
     def __init__(self, fm, lst=None):
         # assume the list is sorted
@@ -49,6 +52,8 @@
             while node and node.val < key:
                 prev_node = node
                 node = node.next
+            import pdb
+            pdb.set_trace()
             prev_node.next = Node(key, node)
 
     @specialize.arg(1)
@@ -171,12 +176,20 @@
     def bind(self, box, loc):
         pos = self.get_loc_index(loc)
         size = self.frame_size(box.type)
-        if self.current_frame_depth < pos:
-            for i in range(self.current_frame_depth, pos):
-                self.freelist.append(1, self.frame_pos(i, INT))
-        self.current_frame_depth = pos + size
+        self.current_frame_depth = max(pos + size, self.current_frame_depth)
         self.bindings[box] = loc
 
+    def finish_binding(self):
+        all = [0] * self.get_frame_depth()
+        for b, loc in self.bindings.iteritems():
+            size = self.frame_size(b)
+            pos = self.get_loc_index(loc)
+            for i in range(pos, pos + size):
+                all[i] = 1
+        for elem in range(len(all)):
+            if not all[elem]:
+                self.freelist._append(elem)
+
     def mark_as_free(self, box):
         try:
             loc = self.bindings[box]
diff --git a/rpython/jit/backend/x86/assembler.py 
b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -504,7 +504,6 @@
         # duplication with assemble_bridge().  Also, we should think
         # about not storing on 'self' attributes that will live only
         # for the duration of compiling one loop or a one bridge.
-
         clt = CompiledLoopToken(self.cpu, looptoken.number)
         clt.frame_info = lltype.malloc(jitframe.JITFRAMEINFO)
         clt.allgcrefs = []
diff --git a/rpython/jit/backend/x86/regalloc.py 
b/rpython/jit/backend/x86/regalloc.py
--- a/rpython/jit/backend/x86/regalloc.py
+++ b/rpython/jit/backend/x86/regalloc.py
@@ -315,6 +315,7 @@
             if reg not in used:
                 self.xrm.free_regs.append(reg)
         self.possibly_free_vars(list(inputargs))
+        self.fm.finish_binding()
         self.rm._check_invariants()
         self.xrm._check_invariants()
 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to