[pypy-svn] r23214 - in pypy/dist/pypy: jit/test rpython

pedronis at codespeak.net pedronis at codespeak.net
Fri Feb 10 19:44:10 CET 2006


Author: pedronis
Date: Fri Feb 10 19:44:09 2006
New Revision: 23214

Modified:
   pypy/dist/pypy/jit/test/test_hint_timeshift.py
   pypy/dist/pypy/rpython/rgenop.py
Log:
check a bit the form of the residual graphs



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	Fri Feb 10 19:44:09 2006
@@ -5,7 +5,7 @@
 from pypy.jit.hintmodel import *
 from pypy.jit.hinttimeshift import HintTimeshift
 from pypy.jit import rtimeshift, hintrtyper
-from pypy.jit.test.test_llabstractinterp import annotation
+from pypy.jit.test.test_llabstractinterp import annotation, summary
 from pypy.rpython.lltypesystem import lltype
 from pypy.rpython.objectmodel import hint
 from pypy.rpython import rgenop
@@ -74,20 +74,25 @@
     else:
         raise NotImplementedError(r)
     jitblock = rtimeshift.ll_close_jitstate(jitstate, result_gvar)
-    return rgenop.runblock(jitblock, residual_graph_args,
-                           viewbefore = conftest.option.view)
+    residual_graph = rgenop.buildgraph(jitblock)
+    insns = summary(residual_graph)
+    res = rgenop.testgengraph(residual_graph, residual_graph_args,
+                              viewbefore = conftest.option.view)
+    return insns, res
 
 def test_simple_fixed():
     def ll_function(x, y):
         return hint(x + y, concrete=True)
-    res = timeshift(ll_function, [5, 7])
+    insns, res = timeshift(ll_function, [5, 7])
     assert res == 12
+    assert insns == {}
 
 def test_simple():
     def ll_function(x, y):
         return x + y
-    res = timeshift(ll_function, [5, 7])
+    insns, res = timeshift(ll_function, [5, 7])
     assert res == 12
+    assert insns == {'int_add': 1}
 
 def test_convert_const_to_redbox():
     def ll_function(x, y):
@@ -97,5 +102,6 @@
             tot += y
             x -= 1
         return tot
-    res = timeshift(ll_function, [7, 2])
+    insns, res = timeshift(ll_function, [7, 2])
     assert res == 14
+    assert insns == {'int_add': 7}

Modified: pypy/dist/pypy/rpython/rgenop.py
==============================================================================
--- pypy/dist/pypy/rpython/rgenop.py	(original)
+++ pypy/dist/pypy/rpython/rgenop.py	Fri Feb 10 19:44:09 2006
@@ -175,14 +175,16 @@
     block = from_opaque_object(blockcontainer.obj)
     return _buildgraph(block)
 
-def runblock(blockcontainer, args, viewbefore=False):
-    block = from_opaque_object(blockcontainer.obj)
+def testgengraph(gengraph, args, viewbefore=False):
     from pypy.rpython.llinterp import LLInterpreter
-    graph = _buildgraph(block)
     if viewbefore:
         graph.show()
     llinterp = LLInterpreter(PseudoRTyper())
-    return llinterp.eval_graph(graph, args)
+    return llinterp.eval_graph(gengraph, args)
+    
+def runblock(blockcontainer, args, viewbefore=False):
+    graph = buildgraph(blockcontainer)
+    return testgengraph(graph, args, viewbefore)
 
 # ____________________________________________________________
 # RTyping of the above functions



More information about the Pypy-commit mailing list