[pypy-commit] pypy jitframe-on-heap: a bit of cowboy style here, but I might change the strategy, so let's see if it works. Fix gcmap passing across loop boundaries

fijal noreply at buildbot.pypy.org
Mon Jan 21 15:31:32 CET 2013


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: jitframe-on-heap
Changeset: r60295:e33a94b89fba
Date: 2013-01-21 16:31 +0200
http://bitbucket.org/pypy/pypy/changeset/e33a94b89fba/

Log:	a bit of cowboy style here, but I might change the strategy, so
	let's see if it works. Fix gcmap passing across loop boundaries

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
@@ -38,7 +38,6 @@
     new_frame = lltype.malloc(JITFRAME, frame_info.jfi_frame_depth, zero=True)
     new_frame.jf_gcmap = frame_info.jfi_gcmap
     new_frame.jf_frame_info = frame_info
-    new_frame.jf_force_descr = frame.jf_force_descr
     return new_frame
 
 JITFRAME = lltype.GcStruct(
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
@@ -695,7 +695,7 @@
                                              len(gcmap))
         for i in range(len(gcmap)):
             frame_info.jfi_gcmap[i] = gcmap[i]
-        
+    
     def get_asmmemmgr_blocks(self, looptoken):
         clt = looptoken.compiled_loop_token
         if clt.asmmemmgr_blocks is None:
@@ -1235,6 +1235,7 @@
         gcrootmap = self.cpu.gc_ll_descr.gcrootmap
         if gcrootmap and gcrootmap.is_shadow_stack:
             rst = gcrootmap.get_root_stack_top_addr()
+            mc.MOV(ecx, ebp) # debugging
             mc.MOV(edx, heap(rst))
             mc.MOV(ebp, mem(edx, -WORD))
             base_ofs = self.cpu.get_baseofs_of_frame_field()
@@ -2396,12 +2397,25 @@
         not_implemented("not implemented operation (guard): %s" %
                         op.getopname())
 
-    def closing_jump(self, target_token):
+    def closing_jump(self, target_token, gcmap):
         target = target_token._x86_loop_code
         if target_token in self.target_tokens_currently_compiling:
             curpos = self.mc.get_relative_pos() + 5
             self.mc.JMP_l(target - curpos)
         else:
+            # bleh, we need to clean up all the references that are not
+            # in our gcmap, but are in the target gcmap
+            if target_token.original_jitcell_token:
+                tgt_clt = target_token.original_jitcell_token.compiled_loop_token
+                tgt_gcmap = tgt_clt.frame_info.jfi_gcmap
+                rev = {}
+                for i in tgt_gcmap:
+                    rev[i] = None
+                # for now clean them all, we might change the strategy
+                for k in gcmap:
+                    if k not in rev:
+                        # all ours that are not known to the target
+                        self.mc.MOV_bi((k + JITFRAME_FIXED_SIZE) * WORD, 0)
             self.mc.JMP(imm(target))
 
     def malloc_cond(self, nursery_free_adr, nursery_top_adr, size, gcpattern):
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
@@ -1284,7 +1284,7 @@
                                  src_locations1, dst_locations1, tmpreg,
                                  src_locations2, dst_locations2, xmmtmp)
         self.possibly_free_vars_for_op(op)
-        assembler.closing_jump(self.jump_target_descr)
+        assembler.closing_jump(self.jump_target_descr, self.get_gc_map())
 
     def consider_debug_merge_point(self, op):
         pass


More information about the pypy-commit mailing list