[pypy-svn] r68424 - in pypy/branch/inline-fastpath-malloc/pypy/jit/backend/x86: . test

fijal at codespeak.net fijal at codespeak.net
Wed Oct 14 11:49:10 CEST 2009


Author: fijal
Date: Wed Oct 14 11:49:09 2009
New Revision: 68424

Modified:
   pypy/branch/inline-fastpath-malloc/pypy/jit/backend/x86/assembler.py
   pypy/branch/inline-fastpath-malloc/pypy/jit/backend/x86/regalloc.py
   pypy/branch/inline-fastpath-malloc/pypy/jit/backend/x86/test/test_gc_integration.py
Log:
Fix some bugs, still segfaults, but it's a bit better


Modified: pypy/branch/inline-fastpath-malloc/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/branch/inline-fastpath-malloc/pypy/jit/backend/x86/assembler.py	(original)
+++ pypy/branch/inline-fastpath-malloc/pypy/jit/backend/x86/assembler.py	Wed Oct 14 11:49:09 2009
@@ -907,7 +907,7 @@
         self.mc.JMP(rel32(loop_token._x86_loop_code))
 
     def malloc_cond_fixedsize(self, nursery_free_adr, nursery_top_adr,
-                              size, tid, push_arg, slowpath_addr):
+                              size, tid, slowpath_addr):
         # don't use self.mc
         mc = self.mc._mc
         mc.MOV(eax, heap(nursery_free_adr))
@@ -915,20 +915,14 @@
         mc.CMP(edx, heap(nursery_top_adr))
         mc.write('\x76\x00') # JNA after the block
         jmp_adr = mc.get_relative_pos()
-        if push_arg is not None:
-            assert push_arg is ecx
-            mc.PUSH(ecx)
         mc.PUSH(imm(size))
         mc.CALL(rel32(slowpath_addr))
+        self.mark_gc_roots()
         # note that slowpath_addr returns a "long long", or more precisely
         # two results, which end up in eax and edx.
         # eax should contain the result of allocation, edx new value
         # of nursery_free_adr
-        if push_arg is not None:
-            mc.POP(ecx)
-            mc.POP(ecx)
-        else:
-            mc.ADD(esp, imm(4))
+        mc.ADD(esp, imm(4))
         offset = mc.get_relative_pos() - jmp_adr
         assert 0 < offset <= 127
         mc.overwrite(jmp_adr-1, chr(offset))

Modified: pypy/branch/inline-fastpath-malloc/pypy/jit/backend/x86/regalloc.py
==============================================================================
--- pypy/branch/inline-fastpath-malloc/pypy/jit/backend/x86/regalloc.py	(original)
+++ pypy/branch/inline-fastpath-malloc/pypy/jit/backend/x86/regalloc.py	Wed Oct 14 11:49:09 2009
@@ -629,19 +629,24 @@
         tmp0 = TempBox()
         self.rm.force_allocate_reg(op.result, selected_reg=eax)
         self.rm.force_allocate_reg(tmp0, selected_reg=edx)
-        for k, v in self.rm.reg_bindings.items():
-            if v is ecx:
-                push_reg = ecx
+        for v, reg in self.rm.reg_bindings.items():
+            if reg is ecx:
+                to_sync = v
                 break
         else:
-            push_reg = None
+            to_sync = None
+        if to_sync is not None:
+            self.rm._sync_var(to_sync)
+            del self.rm.reg_bindings[to_sync]
+            self.rm.free_regs.append(ecx)
+        # we need to do it here, so edx is not in reg_bindings
+        self.rm.possibly_free_var(tmp0)
         self.assembler.malloc_cond_fixedsize(
             gc_ll_descr.get_nursery_free_addr(),
             gc_ll_descr.get_nursery_top_addr(),
-            descr.size, descr.tid, push_reg,
+            descr.size, descr.tid,
             gc_ll_descr.get_malloc_fixedsize_slowpath_addr(),
             )
-        self.rm.possibly_free_var(tmp0)
 
     def consider_new(self, op, ignored):
         gc_ll_descr = self.assembler.cpu.gc_ll_descr

Modified: pypy/branch/inline-fastpath-malloc/pypy/jit/backend/x86/test/test_gc_integration.py
==============================================================================
--- pypy/branch/inline-fastpath-malloc/pypy/jit/backend/x86/test/test_gc_integration.py	(original)
+++ pypy/branch/inline-fastpath-malloc/pypy/jit/backend/x86/test/test_gc_integration.py	Wed Oct 14 11:49:09 2009
@@ -163,6 +163,8 @@
         self.interpret(ops, [0, 0, 0, 0, 0, 0, 0, 0, 0], run=False)
 
 class GCDescrFastpathMalloc(GcLLDescription):
+    gcrootmap = None
+    
     def __init__(self):
         GcCache.__init__(self, False)
         # create a nursery



More information about the Pypy-commit mailing list