Author: hager <sven.ha...@uni-duesseldorf.de> Branch: ppc-jit-backend Changeset: r50766:c28d89a90f9e Date: 2011-12-20 19:06 +0100 http://bitbucket.org/pypy/pypy/changeset/c28d89a90f9e/
Log: implemented GUARD_NOT_INVALIDATED diff --git a/pypy/jit/backend/ppc/ppcgen/opassembler.py b/pypy/jit/backend/ppc/ppcgen/opassembler.py --- a/pypy/jit/backend/ppc/ppcgen/opassembler.py +++ b/pypy/jit/backend/ppc/ppcgen/opassembler.py @@ -284,6 +284,8 @@ raise NotImplementedError self._cmp_guard_class(op, arglocs, regalloc) + def emit_guard_not_invalidated(self, op, locs, regalloc): + return self._emit_guard(op, locs, c.EQ, is_guard_not_invalidated=True) class MiscOpAssembler(object): diff --git a/pypy/jit/backend/ppc/ppcgen/ppc_assembler.py b/pypy/jit/backend/ppc/ppcgen/ppc_assembler.py --- a/pypy/jit/backend/ppc/ppcgen/ppc_assembler.py +++ b/pypy/jit/backend/ppc/ppcgen/ppc_assembler.py @@ -579,9 +579,6 @@ self._teardown() def assemble_bridge(self, faildescr, inputargs, operations, looptoken, log): - - assert 0, "Bridges do not work yet because they need to dynamically adjust the SP" - self.setup(looptoken, operations) assert isinstance(faildescr, AbstractFailDescr) code = faildescr._failure_recovery_code @@ -807,7 +804,8 @@ mc.prepare_insts_blocks(True) mc.copy_to_raw_memory(block_start + tok.offset) else: - assert 0, "not implemented yet" + clt.invalidate_positions.append((block_start + tok.offset, + descr._ppc_guard_pos - tok.offset)) def patch_trace(self, faildescr, looptoken, bridge_addr, regalloc): # The first instruction (word) is not overwritten, because it is the diff --git a/pypy/jit/backend/ppc/ppcgen/regalloc.py b/pypy/jit/backend/ppc/ppcgen/regalloc.py --- a/pypy/jit/backend/ppc/ppcgen/regalloc.py +++ b/pypy/jit/backend/ppc/ppcgen/regalloc.py @@ -336,6 +336,7 @@ return locs prepare_guard_overflow = prepare_guard_no_overflow + prepare_guard_not_invalidated = prepare_guard_no_overflow def prepare_guard_exception(self, op): boxes = list(op.getarglist()) diff --git a/pypy/jit/backend/ppc/runner.py b/pypy/jit/backend/ppc/runner.py --- a/pypy/jit/backend/ppc/runner.py +++ b/pypy/jit/backend/ppc/runner.py @@ -14,6 +14,7 @@ from pypy.jit.backend.ppc.ppcgen.ppc_assembler import AssemblerPPC from pypy.jit.backend.ppc.ppcgen.arch import NONVOLATILES, GPR_SAVE_AREA, WORD from pypy.jit.backend.ppc.ppcgen.regalloc import PPCRegisterManager, PPCFrameManager +from pypy.jit.backend.ppc.ppcgen.codebuilder import PPCBuilder from pypy.jit.backend.ppc.ppcgen import register as r import sys @@ -130,3 +131,20 @@ def teardown(self): self.patch_list = None self.reg_map = None + + def invalidate_loop(self, looptoken): + """Activate all GUARD_NOT_INVALIDATED in the loop and its attached + bridges. Before this call, all GUARD_NOT_INVALIDATED do nothing; + after this call, they all fail. Note that afterwards, if one such + guard fails often enough, it has a bridge attached to it; it is + possible then to re-call invalidate_loop() on the same looptoken, + which must invalidate all newer GUARD_NOT_INVALIDATED, but not the + old one that already has a bridge attached to it.""" + + for jmp, tgt in looptoken.compiled_loop_token.invalidate_positions: + mc = PPCBuilder() + mc.b_offset(tgt) + mc.prepare_insts_blocks() + mc.copy_to_raw_memory(jmp) + # positions invalidated + looptoken.compiled_loop_token.invalidate_positions = [] _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit