[pypy-svn] r20963 - in pypy/dist/pypy/jit: . test

arigo at codespeak.net arigo at codespeak.net
Fri Dec 9 19:21:56 CET 2005


Author: arigo
Date: Fri Dec  9 19:21:53 2005
New Revision: 20963

Modified:
   pypy/dist/pypy/jit/llabstractinterp.py
   pypy/dist/pypy/jit/test/test_jit_tl.py
Log:
(mwh, arigo)

One more test, with one more fix: 'a_return' not being attached to
'graphstate' when the residual blocks are shared among multiple
residual graphs.


Modified: pypy/dist/pypy/jit/llabstractinterp.py
==============================================================================
--- pypy/dist/pypy/jit/llabstractinterp.py	(original)
+++ pypy/dist/pypy/jit/llabstractinterp.py	Fri Dec  9 19:21:53 2005
@@ -14,6 +14,9 @@
     def __init__(self, value):
         self.value = value
 
+    def __repr__(self):
+        return '<concrete %r>' % (self.value,)
+
 #    def __eq__(self, other):
 #        return self.__class__ is other.__class__ and self.value == other.value
 #
@@ -45,6 +48,9 @@
             # we can share the Constant()
             self.copy_v = orig_v
 
+    def __repr__(self):
+        return '<runtime %r>' % (self.copy_v,)
+
     def getconcretetype(self):
         return self.copy_v.concretetype
 
@@ -213,6 +219,7 @@
                         # that it is really the one from 'graph' -- by patching
                         # 'graph' if necessary.
                         if len(link.target.inputargs) == 1:
+                            self.graphstate.a_return = state.args_a[0]
                             graph.returnblock = link.target
                         elif len(link.target.inputargs) == 2:
                             graph.exceptblock = link.target
@@ -275,7 +282,6 @@
             # they are linked to the official return or except block of the
             # copygraph.  If needed, LLConcreteValues are turned into Constants.
             if len(origblock.inputargs) == 1:
-                self.graphstate.a_return = bindings[origblock.inputargs[0]]
                 target = self.graphstate.copygraph.returnblock
             else:
                 XXX_later
@@ -387,9 +393,11 @@
                 graphstate, args_a = self.interp.schedule_graph(
                     args_a, origgraph)
                 if graphstate.state != "during":
+                    print 'ENTERING', graphstate.copygraph.name, args_a
                     graphstate.complete(self.interp)
                     if isinstance(graphstate.a_return, LLConcreteValue):
                         a_result = graphstate.a_return
+                    print 'LEAVING', graphstate.copygraph.name, graphstate.a_return
                 
                 origfptr = v_func.value
                 ARGS = []

Modified: pypy/dist/pypy/jit/test/test_jit_tl.py
==============================================================================
--- pypy/dist/pypy/jit/test/test_jit_tl.py	(original)
+++ pypy/dist/pypy/jit/test/test_jit_tl.py	Fri Dec  9 19:21:53 2005
@@ -26,8 +26,17 @@
     #graph2.show()
 
 
-def test_jit_tl_1():
-    code = tl.compile("""
-        PUSH 42
-    """)
+def run_jit(code):
+    code = tl.compile(code)
     jit_tl(code)
+
+
+def test_jit_tl_1():
+    for code in [
+        ''' PUSH 42
+        ''',
+        ''' PUSH 6
+            PUSH 7
+            ADD
+        ''']:
+        yield run_jit, code



More information about the Pypy-commit mailing list