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

pedronis at codespeak.net pedronis at codespeak.net
Sun Aug 10 15:13:25 CEST 2008


Author: pedronis
Date: Sun Aug 10 15:13:22 2008
New Revision: 57161

Added:
   pypy/dist/pypy/translator/test/test_stackcheck.py   (contents, props changed)
Log:
add a stackcheck insertion test independent from stackless



Added: pypy/dist/pypy/translator/test/test_stackcheck.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/test/test_stackcheck.py	Sun Aug 10 15:13:22 2008
@@ -0,0 +1,35 @@
+from pypy import conftest
+from pypy.translator.translator import TranslationContext
+from pypy.translator.backendopt.all import backend_optimizations
+from pypy.translator.transform import insert_ll_stackcheck
+
+def test_simple():
+    class A(object):
+        def __init__(self, n):
+            self.n = n
+            
+    def f(a):
+        x = A(a.n+1)
+        if x.n == 10:
+            return
+        f(x)
+
+    def g(n):
+        f(A(n))
+    
+    t = TranslationContext()
+    a = t.buildannotator()
+    a.build_types(g, [int])
+    a.simplify()
+    t.buildrtyper().specialize()        
+    backend_optimizations(t)
+    t.checkgraphs()
+    n = insert_ll_stackcheck(t)
+    t.checkgraphs()
+    assert n == 1
+    if conftest.option.view:
+        t.view()
+    
+
+    
+    



More information about the Pypy-commit mailing list