[pypy-svn] r70703 - in pypy/branch/direct-assembler-call/pypy/jit/metainterp: . test
fijal at codespeak.net
fijal at codespeak.net
Tue Jan 19 14:40:44 CET 2010
Author: fijal
Date: Tue Jan 19 14:40:43 2010
New Revision: 70703
Modified:
pypy/branch/direct-assembler-call/pypy/jit/metainterp/history.py
pypy/branch/direct-assembler-call/pypy/jit/metainterp/pyjitpl.py
pypy/branch/direct-assembler-call/pypy/jit/metainterp/resoperation.py
pypy/branch/direct-assembler-call/pypy/jit/metainterp/test/test_ztranslation.py
pypy/branch/direct-assembler-call/pypy/jit/metainterp/warmstate.py
Log:
(pedronis, fijal)
Pass the first test. Trace like a residual call to portal, but instead
substitute residual call with a direct assembler call later on. Break
translation of llgraph backend for now.
Modified: pypy/branch/direct-assembler-call/pypy/jit/metainterp/history.py
==============================================================================
--- pypy/branch/direct-assembler-call/pypy/jit/metainterp/history.py (original)
+++ pypy/branch/direct-assembler-call/pypy/jit/metainterp/history.py Tue Jan 19 14:40:43 2010
@@ -810,6 +810,10 @@
op = ResOperation(opnum, argboxes, resbox, descr)
self.operations.append(op)
return op
+ def substitute_operation(self, position, opnum, argboxes, descr=None):
+ resbox = self.operations[position].result
+ op = ResOperation(opnum, argboxes, resbox, descr)
+ self.operations[position] = op
# ____________________________________________________________
Modified: pypy/branch/direct-assembler-call/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/direct-assembler-call/pypy/jit/metainterp/pyjitpl.py (original)
+++ pypy/branch/direct-assembler-call/pypy/jit/metainterp/pyjitpl.py Tue Jan 19 14:40:43 2010
@@ -663,6 +663,7 @@
@arguments("descr", "varargs")
def opimpl_recursive_call(self, calldescr, varargs):
warmrunnerstate = self.metainterp.staticdata.state
+ token = None
if warmrunnerstate.inlining:
num_green_args = self.metainterp.staticdata.num_green_args
portal_code = self.metainterp.staticdata.portal_code
@@ -670,9 +671,12 @@
if warmrunnerstate.can_inline_callable(greenkey):
return self.perform_call(portal_code, varargs[1:], greenkey)
token = warmrunnerstate.get_assembler_token(greenkey)
- if token is not None:
- return self.metainterp.direct_assembler_call(varargs, token)
- return self.do_residual_call(varargs, descr=calldescr, exc=True)
+ call_position = len(self.metainterp.history.operations)
+ res = self.do_residual_call(varargs, descr=calldescr, exc=True)
+ if token is not None:
+ # this will substitute the residual call with assembler call
+ self.metainterp.direct_assembler_call(varargs, token, call_position)
+ return res
@arguments("descr", "varargs")
def opimpl_residual_call_noexception(self, calldescr, varargs):
@@ -1992,15 +1996,15 @@
max_key = key
return max_key
- def direct_assembler_call(self, varargs, token):
+ def direct_assembler_call(self, varargs, token, call_position):
""" Generate a direct call to assembler for portal entry point.
"""
+ assert not self.is_blackholing() # XXX
num_green_args = self.staticdata.num_green_args
assert self.staticdata.virtualizable_info is None # XXX
args = varargs[num_green_args + 1:]
- xxx
- self.framestack[-1].execute_varargs(rop.CALL_ASSEMBLER, args,
- descr=token, exc=False)
+ self.history.substitute_operation(call_position, rop.CALL_ASSEMBLER,
+ args, descr=token)
class GenerateMergePoint(Exception):
def __init__(self, args, target_loop_token):
Modified: pypy/branch/direct-assembler-call/pypy/jit/metainterp/resoperation.py
==============================================================================
--- pypy/branch/direct-assembler-call/pypy/jit/metainterp/resoperation.py (original)
+++ pypy/branch/direct-assembler-call/pypy/jit/metainterp/resoperation.py Tue Jan 19 14:40:43 2010
@@ -225,6 +225,7 @@
'_CANRAISE_FIRST', # ----- start of can_raise operations -----
'CALL',
+ 'CALL_ASSEMBLER',
'CALL_MAY_FORCE',
'CALL_LOOPINVARIANT',
'OOSEND', # ootype operation
Modified: pypy/branch/direct-assembler-call/pypy/jit/metainterp/test/test_ztranslation.py
==============================================================================
--- pypy/branch/direct-assembler-call/pypy/jit/metainterp/test/test_ztranslation.py (original)
+++ pypy/branch/direct-assembler-call/pypy/jit/metainterp/test/test_ztranslation.py Tue Jan 19 14:40:43 2010
@@ -7,6 +7,8 @@
from pypy.rpython.lltypesystem import lltype, llmemory
from pypy.rpython.ootypesystem import ootype
+py.test.skip("Broken")
+
class TranslationTest:
CPUClass = None
Modified: pypy/branch/direct-assembler-call/pypy/jit/metainterp/warmstate.py
==============================================================================
--- pypy/branch/direct-assembler-call/pypy/jit/metainterp/warmstate.py (original)
+++ pypy/branch/direct-assembler-call/pypy/jit/metainterp/warmstate.py Tue Jan 19 14:40:43 2010
@@ -258,7 +258,7 @@
if vinfo is not None:
vinfo.reset_vable_token(virtualizable)
loop_token = fail_descr.handle_fail(metainterp_sd)
-
+
maybe_compile_and_run._dont_inline_ = True
self.maybe_compile_and_run = maybe_compile_and_run
return maybe_compile_and_run
More information about the Pypy-commit
mailing list