[pypy-commit] pypy jitframe-on-heap: Fixes

arigo noreply at buildbot.pypy.org
Sun Feb 24 11:22:25 CET 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: jitframe-on-heap
Changeset: r61729:eac777ca5d2b
Date: 2013-02-24 11:18 +0100
http://bitbucket.org/pypy/pypy/changeset/eac777ca5d2b/

Log:	Fixes

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
@@ -1123,8 +1123,7 @@
             self.push_gcmap(self.mc, gcmap, store=True)
         self.mc.CALL(x)
         if can_collect:
-            if can_collect != 3:
-                self._reload_frame_if_necessary(self.mc)
+            self._reload_frame_if_necessary(self.mc, can_collect=can_collect)
             if align and can_collect == 1:
                 ofs = self.cpu.get_ofs_of_frame_field('jf_extra_stack_depth')
                 self.mc.MOV_bi(ofs, 0)
@@ -1230,8 +1229,7 @@
             self.push_gcmap(self.mc, gcmap, store=True)
         self.mc.CALL(x)
         if can_collect:
-            if can_collect != 3:
-                self._reload_frame_if_necessary(self.mc)
+            self._reload_frame_if_necessary(self.mc, can_collect=can_collect)
             if align and can_collect == 1:
                 ofs = self.cpu.get_ofs_of_frame_field('jf_extra_stack_depth')
                 self.mc.MOV_bi(ofs, 0)
@@ -1240,12 +1238,19 @@
         if can_collect:
             self.pop_gcmap(self.mc)
 
-    def _reload_frame_if_necessary(self, mc, align_stack=False):
+    def _reload_frame_if_necessary(self, mc, align_stack=False, can_collect=0):
         gcrootmap = self.cpu.gc_ll_descr.gcrootmap
-        if gcrootmap and gcrootmap.is_shadow_stack:
-            rst = gcrootmap.get_root_stack_top_addr()
-            mc.MOV(edx, heap(rst))
-            mc.MOV(ebp, mem(edx, -WORD))
+        if gcrootmap:
+            if gcrootmap.is_shadow_stack:
+                rst = gcrootmap.get_root_stack_top_addr()
+                mc.MOV(ecx, heap(rst))
+                mc.MOV(ebp, mem(ecx, -WORD))
+            elif can_collect == 3:
+                # specially for call_release_gil: must reload ebp from the css
+                from rpython.memory.gctransform import asmgcroot
+                css = WORD * (PASS_ON_MY_FRAME - asmgcroot.JIT_USE_WORDS)
+                index_of_ebp = css + WORD * (2+asmgcroot.INDEX_OF_EBP)
+                mc.MOV_rs(ebp.value, index_of_ebp)  # MOV EBP, [css.ebp]
         wbdescr = self.cpu.gc_ll_descr.write_barrier_descr
         if gcrootmap and wbdescr:
             # frame never uses card marking, so we enforce this is not
@@ -2042,7 +2047,7 @@
             from rpython.memory.gctransform import asmgcroot
             stack_max -= asmgcroot.JIT_USE_WORDS
             can_collect = 3    # asmgcc only: don't write jf_extra_stack_depth,
-                               # and don't call the write barrier on ebp
+                               # and reload ebp from the css
         else:
             can_collect = 1
 
@@ -2164,14 +2169,6 @@
         else:
             from rpython.memory.gctransform import asmgcroot
             css = WORD * (PASS_ON_MY_FRAME - asmgcroot.JIT_USE_WORDS)
-            # Restore ebp
-            index_of_ebp = css + WORD * (2+asmgcroot.INDEX_OF_EBP)
-            self.mc.MOV_rs(ebp.value, index_of_ebp)  # MOV EBP, [css.ebp]
-            wbdescr = self.cpu.gc_ll_descr.write_barrier_descr
-            assert wbdescr
-            self._write_barrier_fastpath(self.mc, wbdescr, [ebp], array=False,
-                                         is_frame=True)
-            #
             extra_ofs = self.cpu.get_ofs_of_frame_field('jf_extra_stack_depth')
             self.mc.MOV_bi(extra_ofs, 0)
             if IS_X86_32:


More information about the pypy-commit mailing list