Author: Maciej Fijalkowski <fij...@gmail.com>
Branch: jitframe-on-heap
Changeset: r62011:b78a2b0c8885
Date: 2013-03-04 20:28 +0200
http://bitbucket.org/pypy/pypy/changeset/b78a2b0c8885/

Log:    (arigo, fijal)
        * kill function that is not necessary any more
        * make sure we can only ever upgrade the frame depth

diff --git a/rpython/jit/backend/arm/assembler.py 
b/rpython/jit/backend/arm/assembler.py
--- a/rpython/jit/backend/arm/assembler.py
+++ b/rpython/jit/backend/arm/assembler.py
@@ -598,7 +598,7 @@
             jitframe.JITFRAMEINFO_SIZE, alignment=WORD)
         clt.frame_info = rffi.cast(jitframe.JITFRAMEINFOPTR, frame_info)
         clt.allgcrefs = []
-        clt.frame_info.set_frame_depth(0, 0) # for now
+        clt.frame_info.update_frame_depth(0, 0) # for now
 
         if False and log:
             operations = self._inject_debugging_code(looptoken, operations,
@@ -854,7 +854,7 @@
 
     def update_frame_depth(self, frame_depth):
         baseofs = self.cpu.get_baseofs_of_frame_field()
-        self.current_clt.frame_info.set_frame_depth(baseofs, frame_depth)
+        self.current_clt.frame_info.update_frame_depth(baseofs, frame_depth)
 
     def write_pending_failure_recoveries(self):
         for tok in self.pending_guards:
diff --git a/rpython/jit/backend/llsupport/jitframe.py 
b/rpython/jit/backend/llsupport/jitframe.py
--- a/rpython/jit/backend/llsupport/jitframe.py
+++ b/rpython/jit/backend/llsupport/jitframe.py
@@ -15,9 +15,10 @@
 NULLGCMAP = lltype.nullptr(GCMAP)
 
 @enforceargs(None, int, int)
-def jitframeinfo_set_depth(jfi, base_ofs, new_depth):
-    jfi.jfi_frame_depth = new_depth
-    jfi.jfi_frame_size = base_ofs + new_depth * SIZEOFSIGNED
+def jitframeinfo_update_depth(jfi, base_ofs, new_depth):
+    if new_depth > jfi.jfi_frame_depth:
+        jfi.jfi_frame_depth = new_depth
+        jfi.jfi_frame_size = base_ofs + new_depth * SIZEOFSIGNED
 
 JITFRAMEINFO_SIZE = 2 * SIZEOFSIGNED # make sure this stays correct
 
@@ -28,7 +29,7 @@
     # the total size of the frame, in bytes
     ('jfi_frame_size', lltype.Signed),
     adtmeths = {
-        'set_frame_depth': jitframeinfo_set_depth,
+        'update_frame_depth': jitframeinfo_update_depth,
     },
 )
 
diff --git a/rpython/jit/backend/llsupport/llmodel.py 
b/rpython/jit/backend/llsupport/llmodel.py
--- a/rpython/jit/backend/llsupport/llmodel.py
+++ b/rpython/jit/backend/llsupport/llmodel.py
@@ -86,7 +86,7 @@
                 if size > frame.jf_frame_info.jfi_frame_depth:
                     # update the frame_info size, which is for whatever reason
                     # not up to date
-                    frame.jf_frame_info.set_frame_depth(base_ofs, size)
+                    frame.jf_frame_info.update_frame_depth(base_ofs, size)
                 new_frame = jitframe.JITFRAME.allocate(frame.jf_frame_info)
                 frame.jf_forward = new_frame
                 i = 0
diff --git a/rpython/jit/backend/model.py b/rpython/jit/backend/model.py
--- a/rpython/jit/backend/model.py
+++ b/rpython/jit/backend/model.py
@@ -315,10 +315,11 @@
         for ref in oldlooptoken.looptokens_redirected_to:
             looptoken = ref()
             if looptoken:
-                looptoken.frame_info.set_frame_depth(baseofs,
+                looptoken.frame_info.update_frame_depth(baseofs,
                                                      new_fi.jfi_frame_depth)
                 new_loop_tokens.append(ref)
-        oldlooptoken.frame_info.set_frame_depth(baseofs, 
new_fi.jfi_frame_depth)
+        oldlooptoken.frame_info.update_frame_depth(baseofs,
+                                                   new_fi.jfi_frame_depth)
         assert oldlooptoken is not None
         new_loop_tokens.append(weakref.ref(oldlooptoken))
         self.looptokens_redirected_to = new_loop_tokens
diff --git a/rpython/jit/backend/test/test_model.py 
b/rpython/jit/backend/test/test_model.py
--- a/rpython/jit/backend/test/test_model.py
+++ b/rpython/jit/backend/test/test_model.py
@@ -13,7 +13,7 @@
     def __init__(self, depth):
         self.jfi_frame_depth = depth
 
-    def set_frame_depth(self, baseofs, newdepth):
+    def update_frame_depth(self, baseofs, newdepth):
         self.jfi_frame_depth = newdepth
 
 def test_redirect_loop_token():
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
@@ -471,7 +471,7 @@
             jitframe.JITFRAMEINFO_SIZE, alignment=WORD)
         clt.frame_info = rffi.cast(jitframe.JITFRAMEINFOPTR, frame_info)
         clt.allgcrefs = []
-        clt.frame_info.set_frame_depth(0, 0) # for now
+        clt.frame_info.update_frame_depth(0, 0) # for now
 
         if log:
             operations = self._inject_debugging_code(looptoken, operations,
@@ -622,7 +622,7 @@
 
     def update_frame_depth(self, frame_depth):
         baseofs = self.cpu.get_baseofs_of_frame_field()
-        self.current_clt.frame_info.set_frame_depth(baseofs, frame_depth)
+        self.current_clt.frame_info.update_frame_depth(baseofs, frame_depth)
 
     def _check_frame_depth(self, mc, gcmap, expected_size=-1):
         """ check if the frame is of enough depth to follow this bridge.
@@ -2392,18 +2392,6 @@
         not_implemented("not implemented operation (guard): %s" %
                         op.getopname())
 
-    def check_frame_before_jump(self, target_token):
-        if target_token in self.target_tokens_currently_compiling:
-            return
-        if target_token._x86_clt is self.current_clt:
-            return
-        # We can have a frame coming from god knows where that's
-        # passed to a jump to another loop. Make sure it has the
-        # correct depth
-        expected_size = target_token._x86_clt.frame_info.jfi_frame_depth
-        self._check_frame_depth(self.mc, self._regalloc.get_gcmap(),
-                                expected_size=expected_size)
-
     def closing_jump(self, target_token):
         target = target_token._ll_loop_code
         if target_token in self.target_tokens_currently_compiling:
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
@@ -1238,7 +1238,6 @@
             tmpreg = None
             xmmtmp = None
         # Do the remapping
-        assembler.check_frame_before_jump(self.jump_target_descr)
         remap_frame_layout_mixed(assembler,
                                  src_locations1, dst_locations1, tmpreg,
                                  src_locations2, dst_locations2, xmmtmp)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to