[pypy-svn] r23155 - in pypy/dist/pypy: jit jit/test rpython
arigo at codespeak.net
arigo at codespeak.net
Wed Feb 8 19:38:08 CET 2006
Author: arigo
Date: Wed Feb 8 19:38:06 2006
New Revision: 23155
Modified:
pypy/dist/pypy/jit/rtimeshift.py
pypy/dist/pypy/jit/test/test_hint_timeshift.py
pypy/dist/pypy/rpython/rgenop.py
Log:
(pedronis, arigo)
Run the residual graphs from the tests, to check them too.
Modified: pypy/dist/pypy/jit/rtimeshift.py
==============================================================================
--- pypy/dist/pypy/jit/rtimeshift.py (original)
+++ pypy/dist/pypy/jit/rtimeshift.py Wed Feb 8 19:38:06 2006
@@ -26,6 +26,11 @@
jitstate.curblock = rgenop.newblock()
return jitstate
+def ll_close_jitstate(jitstate, return_gvar):
+ link = rgenop.closeblock1(jitstate.curblock)
+ rgenop.closereturnlink(link, return_gvar)
+ return jitstate.curblock
+
def ll_input_redbox(jitstate, TYPE):
box = lltype.malloc(REDBOX)
box.genvar = rgenop.geninputarg(jitstate.curblock, TYPE)
Modified: pypy/dist/pypy/jit/test/test_hint_timeshift.py
==============================================================================
--- pypy/dist/pypy/jit/test/test_hint_timeshift.py (original)
+++ pypy/dist/pypy/jit/test/test_hint_timeshift.py Wed Feb 8 19:38:06 2006
@@ -8,6 +8,7 @@
from pypy.jit.test.test_llabstractinterp import annotation
from pypy.rpython.lltypesystem import lltype
from pypy.rpython.objectmodel import hint
+from pypy.rpython import rgenop
from pypy.annotation import model as annmodel
from pypy.rpython.llinterp import LLInterpreter
from pypy.objspace.flow.model import checkgraph
@@ -47,26 +48,41 @@
graph1 = ha.translator.graphs[0]
jitstate = rtimeshift.ll_setup_jitstate()
graph1args = [jitstate]
+ residual_graph_args = []
assert len(graph1.getargs()) == 1 + len(values)
for v, llvalue in zip(graph1.getargs()[1:], values):
color = htshift.varcolor[v]
if color == "green":
graph1args.append(llvalue)
elif color == "red":
- box = rtimeshift.ll_input_redbox(jitstate, v.concretetype)
+ TYPE = htshift.varconcretetype[v]
+ box = rtimeshift.ll_input_redbox(jitstate, TYPE)
graph1args.append(box)
+ residual_graph_args.append(llvalue)
else:
raise NotImplementedError(color)
llinterp = LLInterpreter(rtyper)
result1 = llinterp.eval_graph(graph1, graph1args)
- return result1, jitstate
+ # now try to run the block produced by the jitstate
+ color = htshift.varcolor[graph1.getreturnvar()]
+ if color == "green":
+ result_gvar = rgenop.genconst(jitstate.curblock, result1)
+ elif color == "red":
+ result_gvar = result1.genvar
+ else:
+ raise NotImplementedError(color)
+ jitblock = rtimeshift.ll_close_jitstate(jitstate, result_gvar)
+ return rgenop.runblock(jitblock, residual_graph_args,
+ viewbefore = conftest.option.view)
def test_simple_fixed():
def ll_function(x, y):
return hint(x + y, concrete=True)
- timeshift(ll_function, [5, 7])
+ res = timeshift(ll_function, [5, 7])
+ assert res == 12
def test_simple():
def ll_function(x, y):
return x + y
- timeshift(ll_function, [5, 7])
+ res = timeshift(ll_function, [5, 7])
+ assert res == 12
Modified: pypy/dist/pypy/rpython/rgenop.py
==============================================================================
--- pypy/dist/pypy/rpython/rgenop.py (original)
+++ pypy/dist/pypy/rpython/rgenop.py Wed Feb 8 19:38:06 2006
@@ -175,10 +175,12 @@
block = from_opaque_object(blockcontainer.obj)
return _buildgraph(block)
-def runblock(blockcontainer, args):
+def runblock(blockcontainer, args, viewbefore=False):
block = from_opaque_object(blockcontainer.obj)
from pypy.rpython.llinterp import LLInterpreter
graph = _buildgraph(block)
+ if viewbefore:
+ graph.show()
llinterp = LLInterpreter(PseudoRTyper())
return llinterp.eval_graph(graph, args)
More information about the Pypy-commit
mailing list