Author: Maciej Fijalkowski <[email protected]>
Branch: jitframe-on-heap
Changeset: r60387:4f5e4988ffef
Date: 2013-01-23 21:30 +0200
http://bitbucket.org/pypy/pypy/changeset/4f5e4988ffef/

Log:    some extra sanity

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
@@ -52,11 +52,15 @@
         pass
 
     def _setup_frame_realloc(self, translate_support_code):
-        FUNC_TP = lltype.Ptr(lltype.FuncType([llmemory.GCREF],
+        FUNC_TP = lltype.Ptr(lltype.FuncType([llmemory.GCREF, lltype.Signed,
+                                              lltype.Signed],
                                              llmemory.GCREF))
 
-        def realloc_frame(frame):
+        def realloc_frame(frame, size, asm):
             frame = lltype.cast_opaque_ptr(jitframe.JITFRAMEPTR, frame)
+            assert frame.jf_frame_info.jfi_frame_depth >= size
+            print "realloc frame (%d) %d->%d" % (size, len(frame.jf_frame), 
frame.jf_frame_info.jfi_frame_depth)
+            print "from %x" % asm
             new_frame = jitframe.JITFRAME.allocate(frame.jf_frame_info)
             # XXX now we know, rewrite this
             # we need to do this, because we're not sure what things
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
@@ -24,7 +24,7 @@
 from rpython.jit.metainterp.resoperation import rop, ResOperation
 from rpython.jit.backend.x86 import support
 from rpython.rlib.debug import (debug_print, debug_start, debug_stop,
-                             have_debug_prints)
+                                have_debug_prints)
 from rpython.rlib import rgc
 from rpython.rlib.clibffi import FFI_DEFAULT_ABI
 from rpython.jit.backend.x86.jump import remap_frame_layout
@@ -199,6 +199,8 @@
         mc.MOV_rs(ecx.value, WORD)
         gcmap_ofs = self.cpu.get_ofs_of_frame_field('jf_gcmap')
         mc.MOV_br(gcmap_ofs, ecx.value)
+        mc.MOV_rs(esi.value, WORD*2)
+        mc.MOV_rs(edx.value, WORD*3)
         # push first arg
         mc.LEA_rb(edi.value, -base_ofs)
         # align
@@ -585,8 +587,8 @@
                                              operations,
                                              self.current_clt.allgcrefs,
                                              self.current_clt.frame_info)
-        stack_check_patch_ofs = self._check_frame_depth(self.mc,
-                                                        regalloc.get_gcmap())
+        stack_check_patch_ofs, ofs2 = self._check_frame_depth(self.mc,
+                                                         regalloc.get_gcmap())
         frame_depth = self._assemble(regalloc, inputargs, operations)
         codeendpos = self.mc.get_relative_pos()
         self.write_pending_failure_recoveries()
@@ -607,6 +609,7 @@
         frame_depth = max(self.current_clt.frame_info.jfi_frame_depth,
                           frame_depth + JITFRAME_FIXED_SIZE)
         self._patch_stackadjust(stack_check_patch_ofs + rawstart, frame_depth)
+        self._patch_stackadjust(ofs2 + rawstart, frame_depth)
         self.fixup_target_tokens(rawstart)
         self.current_clt.frame_info.jfi_frame_depth = frame_depth
         self.teardown()
@@ -682,12 +685,15 @@
         mc.J_il8(rx86.Conditions['GE'], 0)
         jg_location = mc.get_relative_pos()
         self.push_gcmap(mc, gcmap, mov=True)
+        mc.MOV_si(WORD, 0xffffff)
+        ofs2 = mc.get_relative_pos() - 4
+        mc.MOV_si(WORD*2, mc.get_relative_pos())
         mc.CALL(imm(self._stack_check_failure))
         # patch the JG above
         offset = mc.get_relative_pos() - jg_location
         assert 0 < offset <= 127
         mc.overwrite(jg_location-1, chr(offset))
-        return stack_check_cmp_ofs
+        return stack_check_cmp_ofs, ofs2
 
     def _patch_stackadjust(self, adr, allocated_depth):
         mc = codebuf.MachineCodeBlockWrapper()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to