Author: Maciej Fijalkowski <fij...@gmail.com> Branch: jitframe-on-heap Changeset: r60401:6b5fd1995177 Date: 2013-01-23 23:05 +0200 http://bitbucket.org/pypy/pypy/changeset/6b5fd1995177/
Log: cleanup my hacks diff --git a/rpython/jit/backend/llsupport/gc.py b/rpython/jit/backend/llsupport/gc.py --- a/rpython/jit/backend/llsupport/gc.py +++ b/rpython/jit/backend/llsupport/gc.py @@ -9,7 +9,7 @@ from rpython.translator.tool.cbuild import ExternalCompilationInfo from rpython.jit.codewriter import heaptracker from rpython.jit.metainterp.history import ConstPtr, AbstractDescr -from rpython.jit.metainterp.resoperation import ResOperation, rop +from rpython.jit.metainterp.resoperation import rop from rpython.jit.backend.llsupport import symbolic, jitframe from rpython.jit.backend.llsupport.symbolic import WORD from rpython.jit.backend.llsupport.descr import SizeDescr, ArrayDescr @@ -154,7 +154,6 @@ def configure_boehm_once(cls): """ Configure boehm only once, since we don't cache failures """ - return if hasattr(cls, 'malloc_fn_ptr'): return cls.malloc_fn_ptr from rpython.rtyper.tool import rffi_platform @@ -194,33 +193,10 @@ def __init__(self, gcdescr, translator, rtyper): GcLLDescription.__init__(self, gcdescr, translator, rtyper) # grab a pointer to the Boehm 'malloc' function - #self.malloc_fn_ptr = self.configure_boehm_once() + self.malloc_fn_ptr = self.configure_boehm_once() self._setup_str() self._make_functions() self.memory = 0 - self.reset_mem() - - def reset_mem(self): - malloc = rffi.llexternal('malloc', [lltype.Signed], lltype.Signed) - free = rffi.llexternal('free', [lltype.Signed], lltype.Void) - if self.memory != 0: - free(self.memory) - self.memory = 0 - A_LOT = 100*1024*1024 - self.memory = malloc(A_LOT) - self.mem_top = self.memory + A_LOT - self.mem_ptr = self.memory - - def malloc_fn_ptr(self, size): - # aligned - if size & 7: - size += 8 - size &= ~7 - from rpython.rtyper.lltypesystem.ll2ctypes import _llgcopaque - assert self.mem_ptr + size < self.mem_top - r = self.mem_ptr - self.mem_ptr += size - return lltype._ptr(llmemory.GCREF, _llgcopaque(r)) def _make_functions(self): 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,21 +52,11 @@ pass def _setup_frame_realloc(self, translate_support_code): - FUNC_TP = lltype.Ptr(lltype.FuncType([llmemory.GCREF, lltype.Signed, - lltype.Signed], + FUNC_TP = lltype.Ptr(lltype.FuncType([llmemory.GCREF], llmemory.GCREF)) def realloc_frame(frame, size, asm): - from rpython.rtyper.lltypesystem.ll2ctypes import _opaque_objs - from rpython.jit.backend.x86.assembler import all_clts frame = lltype.cast_opaque_ptr(jitframe.JITFRAMEPTR, frame) - called_from_clt = all_clts[asm] - coming_from_loop = _opaque_objs[frame.jf_comingfrom._obj.intval // 2] - if not frame.jf_frame_info.jfi_frame_depth >= size: - import pdb - pdb.set_trace() - print "realloc frame (%d) %d->%d" % (size, len(frame.jf_frame), frame.jf_frame_info.jfi_frame_depth) - print "from %x" % asm new_frame = jitframe.JITFRAME.allocate(frame.jf_frame_info) # XXX now we know, rewrite this # we need to do this, because we're not sure what things diff --git a/rpython/jit/backend/test/test_random.py b/rpython/jit/backend/test/test_random.py --- a/rpython/jit/backend/test/test_random.py +++ b/rpython/jit/backend/test/test_random.py @@ -888,10 +888,6 @@ print ' # passed.' if pytest.config.option.output: output.close() - if hasattr(cpu, 'gc_ll_descr'): - func = getattr(cpu.gc_ll_descr, 'reset_mem', None) - if func: - func() print def test_random_function(BuilderClass=OperationBuilder): 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 @@ -35,8 +35,6 @@ from rpython.rlib.rarithmetic import intmask, r_uint from rpython.rlib.objectmodel import compute_unique_id -all_clts = [] - # darwin requires the stack to be 16 bytes aligned on calls. Same for gcc 4.5.0, # better safe than sorry CALL_ALIGN = 16 // WORD @@ -591,7 +589,7 @@ operations, self.current_clt.allgcrefs, self.current_clt.frame_info) - stack_check_patch_ofs, ofs2 = self._check_frame_depth(self.mc, + stack_check_patch_ofs = self._check_frame_depth(self.mc, regalloc.get_gcmap()) frame_depth = self._assemble(regalloc, inputargs, operations) codeendpos = self.mc.get_relative_pos() @@ -613,7 +611,6 @@ frame_depth = max(self.current_clt.frame_info.jfi_frame_depth, frame_depth + JITFRAME_FIXED_SIZE) self._patch_stackadjust(stack_check_patch_ofs + rawstart, frame_depth) - self._patch_stackadjust(ofs2 + rawstart, frame_depth) self.fixup_target_tokens(rawstart) self.update_frame_depth(frame_depth) self.teardown() @@ -700,16 +697,12 @@ mc.J_il8(rx86.Conditions['GE'], 0) jg_location = mc.get_relative_pos() self.push_gcmap(mc, gcmap, mov=True) - mc.MOV_si(WORD, 0xffffff) - ofs2 = mc.get_relative_pos() - 4 - all_clts.append(self.current_clt) - mc.MOV_si(2*WORD, len(all_clts) - 1) mc.CALL(imm(self._stack_check_failure)) # patch the JG above offset = mc.get_relative_pos() - jg_location assert 0 < offset <= 127 mc.overwrite(jg_location-1, chr(offset)) - return stack_check_cmp_ofs, ofs2 + return stack_check_cmp_ofs def _patch_stackadjust(self, adr, allocated_depth): mc = codebuf.MachineCodeBlockWrapper() _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit