[pypy-svn] r79592 - in pypy/branch/jit-unroll-loops/pypy/jit: backend/llgraph metainterp
hakanardo at codespeak.net
hakanardo at codespeak.net
Sat Nov 27 10:52:45 CET 2010
Author: hakanardo
Date: Sat Nov 27 10:52:42 2010
New Revision: 79592
Modified:
pypy/branch/jit-unroll-loops/pypy/jit/backend/llgraph/runner.py
pypy/branch/jit-unroll-loops/pypy/jit/metainterp/compile.py
Log:
Fallback for backends that not support emitting guards with preset jumptargets
Modified: pypy/branch/jit-unroll-loops/pypy/jit/backend/llgraph/runner.py
==============================================================================
--- pypy/branch/jit-unroll-loops/pypy/jit/backend/llgraph/runner.py (original)
+++ pypy/branch/jit-unroll-loops/pypy/jit/backend/llgraph/runner.py Sat Nov 27 10:52:42 2010
@@ -196,6 +196,8 @@
assert isinstance(token, history.LoopToken)
compiled_version = token._llgraph_compiled_version
llimpl.compile_add_guard_jump_target(c, compiled_version)
+ # Inform frontend that guard is patched to jump to token
+ op.setjumptarget(None)
x = op.result
if x is not None:
Modified: pypy/branch/jit-unroll-loops/pypy/jit/metainterp/compile.py
==============================================================================
--- pypy/branch/jit-unroll-loops/pypy/jit/metainterp/compile.py (original)
+++ pypy/branch/jit-unroll-loops/pypy/jit/metainterp/compile.py Sat Nov 27 10:52:42 2010
@@ -540,8 +540,29 @@
# know exactly what we must do (ResumeGuardDescr/ResumeFromInterpDescr)
prepare_last_operation(new_loop, target_loop_token)
resumekey.compile_and_attach(metainterp, new_loop)
+ compile_known_target_bridges(metainterp, new_loop)
return target_loop_token
+# For backends that not supports emitting guards with preset jump
+# targets, emit mini-bridges containing the jump
+def compile_known_target_bridges(metainterp, bridge):
+ for op in bridge.operations:
+ if op.is_guard():
+ target = op.getjumptarget()
+ if target:
+ mini = create_empty_loop(metainterp, 'fallback')
+ mini.inputargs = op.getfailargs()[:]
+ jmp = ResOperation(rop.JUMP, mini.inputargs[:], None, target)
+ mini.operations = [jmp]
+ descr = op.getdescr()
+
+ #descr.compile_and_attach(metainterp, mini)
+ if not we_are_translated():
+ descr._debug_suboperations = mini.operations
+ send_bridge_to_backend(metainterp.staticdata, descr,
+ mini.inputargs, mini.operations)
+
+
def prepare_last_operation(new_loop, target_loop_token):
op = new_loop.operations[-1]
if not isinstance(target_loop_token, TerminatingLoopToken):
More information about the Pypy-commit
mailing list