[pypy-svn] r26897 - pypy/dist/pypy/rpython/lltypesystem/test

arigo at codespeak.net arigo at codespeak.net
Sat May 6 21:35:56 CEST 2006


Author: arigo
Date: Sat May  6 21:35:56 2006
New Revision: 26897

Modified:
   pypy/dist/pypy/rpython/lltypesystem/test/test_rtagged.py
Log:
Intermediate check-in: run this test with --view, then in the last (3rd)
time the pygame viewer shows up, search for the indirect_call in the
last block of the entry point function.  It should eventually be
"constant-folded" into a direct_call in one of the two incoming links.



Modified: pypy/dist/pypy/rpython/lltypesystem/test/test_rtagged.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/test/test_rtagged.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/test/test_rtagged.py	Sat May  6 21:35:56 2006
@@ -1,7 +1,9 @@
 import sys
-from pypy.rpython.test.test_llinterp import interpret
+from pypy.rpython.test.test_llinterp import interpret, get_interpreter
 from pypy.rpython.lltypesystem import lltype
 from pypy.rpython.objectmodel import UnboxedValue
+from pypy.translator.backendopt.all import backend_optimizations
+from pypy import conftest
 
 
 class A(object):
@@ -150,3 +152,17 @@
     assert res == 1102
     res = interpret(fn, [-1000])
     assert res == -897
+
+def test_optimize_method():
+    def fn(n):
+        if n > 0:
+            x = B(n)
+        else:
+            x = C(n)
+        return x.meth(100)
+    interp, graph = get_interpreter(fn, [1000])
+    t = interp.typer.annotator.translator
+    backend_optimizations(t, propagate=True)
+    if conftest.option.view:
+        t.view()
+    # XXX finish writing this test



More information about the Pypy-commit mailing list