Author: Armin Rigo <ar...@tunes.org> Branch: jitframe-on-heap Changeset: r61079:327693ffe242 Date: 2013-02-11 11:51 +0100 http://bitbucket.org/pypy/pypy/changeset/327693ffe242/
Log: merge heads 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,8 +52,12 @@ # the same as normal JITFRAME, however with an array of pointers self.refarraydescr = ArrayDescr(ad.basesize, ad.itemsize, ad.lendescr, FLAG_POINTER) - self.floatarraydescr = ArrayDescr(ad.basesize, ad.itemsize, ad.lendescr, - FLAG_FLOAT) + if WORD == 4: + self.floatarraydescr = ArrayDescr(ad.basesize, ad.itemsize * 2, + ad.lendescr, FLAG_FLOAT) + else: + self.floatarraydescr = ArrayDescr(ad.basesize, ad.itemsize, + ad.lendescr, FLAG_FLOAT) self.setup() def getarraydescr_for_frame(self, type): diff --git a/rpython/jit/backend/llsupport/rewrite.py b/rpython/jit/backend/llsupport/rewrite.py --- a/rpython/jit/backend/llsupport/rewrite.py +++ b/rpython/jit/backend/llsupport/rewrite.py @@ -175,15 +175,20 @@ None, descr=descrs.jf_frame_info) self.newops.append(op2) arglist = op.getarglist() - index = self.cpu.getarryoffset_for_frame() + index = self.cpu.getarryoffset_for_frame() for i, arg in enumerate(arglist): descr = self.cpu.getarraydescr_for_frame(arg.type) - self.newops.append(ResOperation(rop.SETARRAYITEM_GC, - [frame, ConstInt(index), arg], - None, descr)) - if WORD == 4 and type == history.FLOAT: - index += 2 + if WORD == 4 and arg.type == history.FLOAT: + self.newops.append(ResOperation(rop.SETARRAYITEM_GC, + [frame, ConstInt(index // 2), + arg], + None, descr)) + index += 2 else: + self.newops.append(ResOperation(rop.SETARRAYITEM_GC, + [frame, ConstInt(index), + arg], + None, descr)) index += 1 descr = op.getdescr() assert isinstance(descr, JitCellToken) 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 @@ -211,12 +211,14 @@ # push first arg mc.MOV_rr(edi.value, ebp.value) align = align_stack_words(1) + mc.SUB_ri(esp.value, (align - 1) * WORD) else: - mc.PUSH(RawStackLoc(WORD * 2)) - mc.PUSH_r(ebp.value) align = align_stack_words(3) + mc.MOV_rs(eax.value, WORD * 2) + mc.SUB_ri(esp.value, (align - 1) * WORD) + mc.MOV_sr(WORD, eax.value) + mc.MOV_sr(0, ebp.value) # align - mc.SUB_ri(esp.value, (align - 1) * WORD) mc.CALL(imm(self.cpu.realloc_frame)) mc.ADD_ri(esp.value, (align - 1) * WORD) @@ -1140,7 +1142,7 @@ stack_depth += 2 else: stack_depth += 1 - stack_depth += loc.get_width() + stack_depth += loc.get_width() // WORD if stack_depth > PASS_ON_MY_FRAME: stack_depth = align_stack_words(stack_depth) align = (stack_depth - PASS_ON_MY_FRAME) @@ -1175,17 +1177,16 @@ self.mc.CALL(x) if can_collect: self._reload_frame_if_necessary(self.mc) - if align: - self.mc.ADD_ri(esp.value, align * WORD) if can_collect: self.pop_gcmap(self.mc) # if callconv != FFI_DEFAULT_ABI: - self._fix_stdcall(callconv, p) + self._fix_stdcall(callconv, p - align * WORD) + elif align: + self.mc.ADD_ri(esp.value, align * WORD) def _fix_stdcall(self, callconv, p): from rpython.rlib.clibffi import FFI_STDCALL - xxx assert callconv == FFI_STDCALL # it's a bit stupid, but we're just going to cancel the fact that # the called function just added 'p' to ESP, by subtracting it again. 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 @@ -164,7 +164,7 @@ def prepare_loop(self, inputargs, operations, looptoken, allgcrefs): operations = self._prepare(inputargs, operations, allgcrefs) - self._set_initial_bindings(inputargs) + self._set_initial_bindings(inputargs, looptoken) # note: we need to make a copy of inputargs because possibly_free_vars # is also used on op args, which is a non-resizable list self.possibly_free_vars(list(inputargs)) @@ -188,10 +188,13 @@ def get_final_frame_depth(self): return self.fm.get_frame_depth() - def _set_initial_bindings(self, inputargs): + def _set_initial_bindings(self, inputargs, looptoken): + locs = [] for box in inputargs: assert isinstance(box, Box) - self.fm.get_new_loc(box) + loc = self.fm.get_new_loc(box) + locs.append(loc.value) + looptoken.compiled_loop_token._x86_initial_locs = locs def possibly_free_var(self, var): if var.type == FLOAT: diff --git a/rpython/jit/backend/x86/runner.py b/rpython/jit/backend/x86/runner.py --- a/rpython/jit/backend/x86/runner.py +++ b/rpython/jit/backend/x86/runner.py @@ -56,7 +56,7 @@ return 1000 def getarryoffset_for_frame(self): - return JITFRAME_FIXED_SIZE + return JITFRAME_FIXED_SIZE def setup(self): self.assembler = Assembler386(self, self.translate_support_code) @@ -119,25 +119,24 @@ #llop.debug_print(lltype.Void, ">>>> Entering", addr) frame_info = clt.frame_info frame = self.gc_ll_descr.malloc_jitframe(frame_info) + base_ofs = self.get_baseofs_of_frame_field() ll_frame = lltype.cast_opaque_ptr(llmemory.GCREF, frame) + locs = executable_token.compiled_loop_token._x86_initial_locs prev_interpreter = None # help flow space if not self.translate_support_code: prev_interpreter = LLInterpreter.current_interpreter LLInterpreter.current_interpreter = self.debug_ll_interpreter try: - num = JITFRAME_FIXED_SIZE * WORD for i, kind in kinds: arg = args[i] + num = locs[i] - base_ofs if kind == history.INT: self.set_int_value(ll_frame, num, arg) elif kind == history.FLOAT: self.set_float_value(ll_frame, num, arg) - if IS_X86_32: - num += WORD else: assert kind == history.REF self.set_ref_value(ll_frame, num, arg) - num += WORD ll_frame = func(ll_frame) finally: if not self.translate_support_code: diff --git a/rpython/jit/backend/x86/test/test_runner.py b/rpython/jit/backend/x86/test/test_runner.py --- a/rpython/jit/backend/x86/test/test_runner.py +++ b/rpython/jit/backend/x86/test/test_runner.py @@ -31,8 +31,11 @@ # ====> ../../test/runner_test.py add_loop_instructions = ['mov', 'add', 'test', 'je', 'jmp'] - bridge_loop_instructions = ['cmp', 'jge', 'mov', 'mov', 'mov', 'mov', - 'call', 'mov', 'jmp'] + if WORD == 4: + bridge_loop_instructions = ['cmp', 'jge', 'mov', 'mov', 'call', 'jmp'] + else: + bridge_loop_instructions = ['cmp', 'jge', 'mov', 'mov', 'mov', 'mov', + 'call', 'mov', 'jmp'] def get_cpu(self): cpu = CPU(rtyper=None, stats=FakeStats()) @@ -497,7 +500,7 @@ ResOperation(rop.GUARD_FALSE, [i3], None, descr=BasicFailDescr(0)), ResOperation(rop.FINISH, [], None, - descr=BasicFailDescr(1)) + descr=BasicFinalDescr(1)) ] ops[-2].setfailargs([i3, i4, i5, i6]) ops[1].setfailargs([]) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit