Author: Maciej Fijalkowski <fij...@gmail.com> Branch: jitframe-on-heap Changeset: r61126:45ecdb12c70d Date: 2013-02-12 13:05 +0200 http://bitbucket.org/pypy/pypy/changeset/45ecdb12c70d/
Log: fixes for gc_integration 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 @@ -322,14 +322,11 @@ # have been used to pass arguments. Note that we pass only # one argument, that is the frame mc.PUSH_r(edi.value) + mc.MOV_rr(edi.value, esp.value) # if IS_X86_32: - xxx - stack_size += 2*WORD - mc.PUSH_r(eax.value) # alignment + mc.SUB_ri(esp.value, 2*WORD) # alignment mc.PUSH_r(esp.value) - elif IS_X86_64: - mc.MOV_rr(edi.value, esp.value) # # esp is now aligned to a multiple of 16 again mc.CALL(imm(slowpathaddr)) @@ -340,9 +337,8 @@ jnz_location = mc.get_relative_pos() # if IS_X86_32: - xxxx - mc.ADD_ri(esp.value, 2*WORD) # cancel the two PUSHes above - elif IS_X86_64: + mc.ADD_ri(esp.value, 3*WORD) # alignment + else: # restore the edi mc.POP_r(edi.value) # @@ -396,16 +392,18 @@ mc.SUB_ri(esp.value, 2 * WORD) mc.MOV_rs(eax.value, 3 * WORD) # 2 + 1 mc.MOV_sr(0, eax.value) - elif IS_X86_64: + else: mc.MOV_rs(edi.value, WORD) else: # we're possibly called from the slowpath of malloc, so we have # one extra CALL on the stack, but one less PUSH, # save to store stuff 2 locations away on the stack. + mc.MOV_sr(3 * WORD, eax.value) # save for later if IS_X86_32: - xxx - mc.MOV_sr(3*WORD, eax.value) - mc.MOV_rr(edi.value, ebp.value) + mc.SUB_ri(esp.value, 2 * WORD) # align + mc.MOV_sr(0, ebp.value) + else: + mc.MOV_rr(edi.value, ebp.value) mc.CALL(imm(func)) # @@ -429,8 +427,8 @@ mc.RET16_i(WORD) else: if IS_X86_32: - XXX - mc.MOV_rs(eax.value, 3 * WORD) + mc.LEA_rs(esp.value, 2 * WORD) + mc.MOV_rs(eax.value, 3 * WORD) # restore mc.RET() rawstart = mc.materialize(self.cpu.asmmemmgr, []) diff --git a/rpython/jit/backend/x86/test/test_gc_integration.py b/rpython/jit/backend/x86/test/test_gc_integration.py --- a/rpython/jit/backend/x86/test/test_gc_integration.py +++ b/rpython/jit/backend/x86/test/test_gc_integration.py @@ -7,7 +7,7 @@ from rpython.jit.backend.llsupport.gc import GcLLDescription, GcLLDescr_boehm,\ GcLLDescr_framework, GcCache, JitFrameDescrs from rpython.jit.backend.detect_cpu import getcpuclass -from rpython.jit.backend.x86.arch import WORD, JITFRAME_FIXED_SIZE +from rpython.jit.backend.x86.arch import WORD, JITFRAME_FIXED_SIZE, IS_X86_64 from rpython.jit.backend.llsupport import jitframe from rpython.rtyper.lltypesystem import lltype, llmemory, rffi from rpython.rtyper.annlowlevel import llhelper, llhelper_args @@ -71,10 +71,15 @@ # the gcmap should contain three things, p0, p1 and p3 # p3 stays in a register # while p0 and p1 are on the frame - assert frame.jf_gcmap[0] == (1 << 11) | (1 << 12) | (1 << 31) - assert frame.jf_frame[11] - assert frame.jf_frame[12] - assert frame.jf_frame[31] + if IS_X86_64: + nos = [11, 12, 31] + else: + nos = [4, 5, 25] + assert frame.jf_gcmap[0] == ((1 << nos[0]) | (1 << nos[1]) | + (1 << nos[2])) + assert frame.jf_frame[nos[0]] + assert frame.jf_frame[nos[1]] + assert frame.jf_frame[nos[2]] def test_rewrite_constptr(self): ops = ''' _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit