[pypy-svn] r18601 - in pypy/dist/pypy/rpython/l3interp: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Sat Oct 15 11:42:03 CEST 2005


Author: cfbolz
Date: Sat Oct 15 11:42:01 2005
New Revision: 18601

Modified:
   pypy/dist/pypy/rpython/l3interp/l3interp.py
   pypy/dist/pypy/rpython/l3interp/test/test_l3interp.py
Log:
failing translation test???



Modified: pypy/dist/pypy/rpython/l3interp/l3interp.py
==============================================================================
--- pypy/dist/pypy/rpython/l3interp/l3interp.py	(original)
+++ pypy/dist/pypy/rpython/l3interp/l3interp.py	Sat Oct 15 11:42:01 2005
@@ -21,7 +21,7 @@
         assert len(args) == 0, "not implemented, XXX"
         link = self.graph.startlink
 #        self.fill_input_arg(...
-        while type(link) == model.Link:
+        while type(link) is model.Link:
             link = self.eval_block(link.target)
             self.copy_link_vars(link)
         return link
@@ -37,6 +37,8 @@
         
 
     def copy_link_vars(self, link):
+        if not len(link.move_int_registers):
+            return
         for i in range(0, len(link.move_int_registers), 2):
             source = link.move_int_registers[i]
             target = link.move_int_registers[i + 1]

Modified: pypy/dist/pypy/rpython/l3interp/test/test_l3interp.py
==============================================================================
--- pypy/dist/pypy/rpython/l3interp/test/test_l3interp.py	(original)
+++ pypy/dist/pypy/rpython/l3interp/test/test_l3interp.py	Sat Oct 15 11:42:01 2005
@@ -1,7 +1,10 @@
 from pypy.rpython.l3interp import l3interp
 from pypy.rpython.l3interp import model
+from pypy.translator.c.test.test_genc import compile
+from pypy.translator.translator import Translator
+from pypy.annotation import policy
 
-def test_very_simple():
+def eval_seven():
     op = model.Operation(l3interp.LLFrame.op_int_add, 0, [-1, -2])
     returnlink = model.ReturnLink(None, [])
     block = model.Block([], model.ONE_EXIT, [returnlink])
@@ -12,6 +15,19 @@
     g = model.Globals()
     g.graphs = [graph]
     interp = l3interp.LLInterpreter()
-    result = interp.eval_graph_int(graph, [])
+    return interp.eval_graph_int(graph, [])
+      
+
+def test_very_simple():
+    result = eval_seven()
     assert result == 7
-    
+
+def test_very_simple_translated():
+    t = Translator(eval_seven)
+    pol = policy.AnnotatorPolicy()
+    pol.allow_someobjects = False
+    t.annotate([], policy=pol)
+    t.specialize()
+    t.view()
+    fn = t.ccompile()
+



More information about the Pypy-commit mailing list