[pypy-svn] r48167 - in pypy/dist/pypy/translator/llvm: . module test

rxe at codespeak.net rxe at codespeak.net
Mon Oct 29 17:13:47 CET 2007


Author: rxe
Date: Mon Oct 29 17:13:46 2007
New Revision: 48167

Modified:
   pypy/dist/pypy/translator/llvm/exception.py
   pypy/dist/pypy/translator/llvm/module/excsupport.py
   pypy/dist/pypy/translator/llvm/test/test_lltype.py
Log:
maybe a better attemptn

Modified: pypy/dist/pypy/translator/llvm/exception.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/exception.py	(original)
+++ pypy/dist/pypy/translator/llvm/exception.py	Mon Oct 29 17:13:46 2007
@@ -20,7 +20,7 @@
     noresult = _noresult(returntype)
 
     code = raisedcode % locals()
-    if returntype == "void":
+    if returntype == "void ":
         code += voidentrycode % locals()
     else:
         code += entrycode % locals()

Modified: pypy/dist/pypy/translator/llvm/module/excsupport.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/module/excsupport.py	(original)
+++ pypy/dist/pypy/translator/llvm/module/excsupport.py	Mon Oct 29 17:13:46 2007
@@ -18,16 +18,8 @@
 voidentrycode = '''
 ccc %(returntype)s%%__entrypoint__%(entrypointname)s {
     store %%RPYTHON_EXCEPTION_VTABLE* null, %%RPYTHON_EXCEPTION_VTABLE** %%last_exception_type
-    %%result = call %(cconv)s %(returntype)s%%%(entrypointname)s
-    %%tmp    = load %%RPYTHON_EXCEPTION_VTABLE** %%last_exception_type
-    %%exc    = seteq %%RPYTHON_EXCEPTION_VTABLE* %%tmp, null
-    br bool %%exc, label %%no_exception, label %%exception
-
-no_exception:
-    ret %(returntype)s %%result
-
-exception:
-    ret %(noresult)s
+    call %(cconv)s %(returntype)s%%%(entrypointname)s
+    ret void
 }
 '''
 

Modified: pypy/dist/pypy/translator/llvm/test/test_lltype.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/test/test_lltype.py	(original)
+++ pypy/dist/pypy/translator/llvm/test/test_lltype.py	Mon Oct 29 17:13:46 2007
@@ -748,6 +748,17 @@
     assert fn(0) == 0
     assert fn(42) == 42 * 2**32
 
+def test_rettypes():
+    ' test returning bool and void types '
+    def llf():
+        return
+    fn = compile_function(llf, [])
+    assert fn() is None
+    def llf():
+        return not(False)
+    fn = compile_function(llf, [])
+    assert fn() is True
+
 class TestLowLevelType(object):
     def getcompiled(self, f, args=[]):
         return compile_function(f, args)



More information about the Pypy-commit mailing list