[pypy-svn] r14114 - pypy/dist/pypy/translator/test

ericvrp at codespeak.net ericvrp at codespeak.net
Sat Jul 2 20:33:45 CEST 2005


Author: ericvrp
Date: Sat Jul  2 20:33:44 2005
New Revision: 14114

Modified:
   pypy/dist/pypy/translator/test/test_backendoptimization.py
Log:
(failed) attempt to create a structure with voids in it. 
Who wants/can improve this?


Modified: pypy/dist/pypy/translator/test/test_backendoptimization.py
==============================================================================
--- pypy/dist/pypy/translator/test/test_backendoptimization.py	(original)
+++ pypy/dist/pypy/translator/test/test_backendoptimization.py	Sat Jul  2 20:33:44 2005
@@ -3,6 +3,11 @@
 from pypy.rpython.lltype import Void
 from pypy.rpython.llinterp import LLInterpreter
 from pypy.objspace.flow.model import checkgraph
+from pypy.translator.test.snippet import simple_method
+from pypy.translator.llvm2.log import log
+
+import py
+log = py.log.Producer('test_backendoptimization')
 
 def annotate_and_remove_void(f, annotate):
     t = Translator(f)
@@ -22,3 +27,18 @@
     interp = LLInterpreter(t.flowgraphs, t.rtyper)
     assert interp.eval_function(f, [0]) == 1 
 
+def test_remove_void_in_struct():
+    t = annotate_and_remove_void(simple_method, [int])
+    #t.view()
+    log(t.flowgraphs.iteritems())
+    for func, graph in t.flowgraphs.iteritems():
+        log('func : ' + str(func))
+        log('graph: ' + str(graph))
+        assert checkgraph(graph) is None
+        #for fieldname in self.struct._names:    #XXX helper (in lltype?) should remove these voids
+        #    type_ = getattr(struct, fieldname)
+        #    log('fieldname=%(fieldname)s , type_=%(type_)s' % locals())
+        #    assert _type is not Void
+    #interp = LLInterpreter(t.flowgraphs, t.rtyper)
+    #assert interp.eval_function(f, [0]) == 1 
+



More information about the Pypy-commit mailing list