Author: Armin Rigo <ar...@tunes.org> Branch: guard-compatible Changeset: r83032:c51aa683936e Date: 2016-03-14 11:35 +0100 http://bitbucket.org/pypy/pypy/changeset/c51aa683936e/
Log: Change the interface again to take a CompiledLoopToken diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py --- a/rpython/jit/backend/llgraph/runner.py +++ b/rpython/jit/backend/llgraph/runner.py @@ -470,7 +470,7 @@ assert deadframe._saved_data is not None return deadframe._saved_data - def grow_guard_compatible_switch(self, looptoken, descr, ref): + def grow_guard_compatible_switch(self, compiled_loop_token, descr, ref): if not hasattr(descr, '_guard_compatible_llgraph_lst'): descr._guard_compatible_llgraph_lst = [] descr._guard_compatible_llgraph_lst.append(ref) diff --git a/rpython/jit/backend/model.py b/rpython/jit/backend/model.py --- a/rpython/jit/backend/model.py +++ b/rpython/jit/backend/model.py @@ -158,7 +158,8 @@ """ pass - def grow_guard_compatible_switch(self, looptoken, guarddescr, gcref): + def grow_guard_compatible_switch(self, compiled_loop_token, + guarddescr, gcref): """ This method is called to add another case to a guard_compatible. guard_compatible starts like a guard_value, but can grow to check more cases. The guard should only fail if the argument is unequal to all the @@ -308,6 +309,11 @@ debug_print("allocating Loop #", self.number) debug_stop("jit-mem-looptoken-alloc") + def get_asmmemmgr_blocks(self): + if self.asmmemmgr_blocks is None: + self.asmmemmgr_blocks = [] + return self.asmmemmgr_blocks + def compiling_a_bridge(self): self.cpu.tracker.total_compiled_bridges += 1 self.bridges_count += 1 diff --git a/rpython/jit/backend/test/runner_test.py b/rpython/jit/backend/test/runner_test.py --- a/rpython/jit/backend/test/runner_test.py +++ b/rpython/jit/backend/test/runner_test.py @@ -214,8 +214,8 @@ fail = self.cpu.get_latest_descr(deadframe) assert fail.identifier == 1 - self.cpu.grow_guard_compatible_switch(looptoken, faildescr1, - t2_box._resref) + self.cpu.grow_guard_compatible_switch(looptoken.compiled_loop_token, + faildescr1, t2_box._resref) for retry in range(2): deadframe = self.cpu.execute_token(looptoken, t2_box._resref) 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 @@ -774,12 +774,9 @@ mc.writeimm32(allocated_depth) mc.copy_to_raw_memory(adr) - @staticmethod - def get_asmmemmgr_blocks(looptoken): + def get_asmmemmgr_blocks(self, looptoken): clt = looptoken.compiled_loop_token - if clt.asmmemmgr_blocks is None: - clt.asmmemmgr_blocks = [] - return clt.asmmemmgr_blocks + return clt.get_asmmemmgr_blocks() def materialize_loop(self, looptoken): self.datablockwrapper.done() # finish using cpu.asmmemmgr diff --git a/rpython/jit/backend/x86/guard_compat.py b/rpython/jit/backend/x86/guard_compat.py --- a/rpython/jit/backend/x86/guard_compat.py +++ b/rpython/jit/backend/x86/guard_compat.py @@ -61,9 +61,7 @@ descr._backend_compatinfo = rawstart + tok.pos_compatinfo_offset -def grow_switch(cpu, looptoken, guarddescr, gcref): - from rpython.jit.backend.x86.assembler import Assembler386 - +def grow_switch(cpu, compiled_loop_token, guarddescr, gcref): # XXX is it ok to force gcref to be non-movable? if not rgc._make_sure_does_not_move(gcref): raise AssertionError("oops") @@ -79,7 +77,7 @@ while compatinfo[length - 1] != -1: length += 1 - allblocks = Assembler386.get_asmmemmgr_blocks(looptoken) + allblocks = compiled_loop_token.get_asmmemmgr_blocks() datablockwrapper = MachineDataBlockWrapper(cpu.asmmemmgr, allblocks) newcompatinfoaddr = datablockwrapper.malloc_aligned( (length + 1) * WORD, alignment=WORD) 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 @@ -122,8 +122,9 @@ l[i].counter = ll_s.i return l - def grow_guard_compatible_switch(self, looptoken, guarddescr, gcref): - guard_compat.grow_switch(self, looptoken, guarddescr, gcref) + def grow_guard_compatible_switch(self, compiled_loop_token, + guarddescr, gcref): + guard_compat.grow_switch(self, compiled_loop_token, guarddescr, gcref) class CPU386(AbstractX86CPU): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit