[pypy-svn] r48238 - pypy/dist/pypy/translator/llvm/module

rxe at codespeak.net rxe at codespeak.net
Thu Nov 1 14:39:56 CET 2007


Author: rxe
Date: Thu Nov  1 14:39:55 2007
New Revision: 48238

Modified:
   pypy/dist/pypy/translator/llvm/module/excsupport.py
   pypy/dist/pypy/translator/llvm/module/support.py
Log:
well, well...  so it is seems that we have been running two independent exception strategies in llvm - one for the backend and the tests, and the other one done by transformation.  so upshot is none of the externs could raise a real error and our tests never raised an error.  ive know idea how long this has been this way - probably a veeery long time. (and it is probably my fault :-)

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	Thu Nov  1 14:39:55 2007
@@ -1,7 +1,7 @@
 
 entrycode = '''
 ccc %(returntype)s %%__entrypoint__%(entrypointname)s {
-    store %%RPYTHON_EXCEPTION_VTABLE* null, %%RPYTHON_EXCEPTION_VTABLE** %%last_exception_type
+    call fastcc void %%pypy_rpyexc_clear()
     %%result = call %(cconv)s %(returntype)s%%%(entrypointname)s
     ret %(returntype)s %%result
 }
@@ -9,18 +9,15 @@
 
 voidentrycode = '''
 ccc %(returntype)s %%__entrypoint__%(entrypointname)s {
-    store %%RPYTHON_EXCEPTION_VTABLE* null, %%RPYTHON_EXCEPTION_VTABLE** %%last_exception_type
+    call fastcc void %%pypy_rpyexc_clear()
     call %(cconv)s %(returntype)s%%%(entrypointname)s
     ret void
 }
 '''
 
 raisedcode = '''
-;XXX this should use the transformation data that has the same purpose
-ccc int %%__entrypoint__raised_LLVMException() {
-    %%tmp    = load %%RPYTHON_EXCEPTION_VTABLE** %%last_exception_type
-    %%result = cast %%RPYTHON_EXCEPTION_VTABLE* %%tmp to int
-    ret int %%result
+ccc bool %%__entrypoint__raised_LLVMException() {
+    %%result = call fastcc bool %%pypy_rpyexc_occured()
+    ret bool %%result
 }
-
 '''

Modified: pypy/dist/pypy/translator/llvm/module/support.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/module/support.py	(original)
+++ pypy/dist/pypy/translator/llvm/module/support.py	Thu Nov  1 14:39:55 2007
@@ -1,8 +1,4 @@
-
 extdeclarations = """
-%last_exception_type  = internal global %RPYTHON_EXCEPTION_VTABLE* null
-%last_exception_value = internal global %RPYTHON_EXCEPTION* null
-
 declare ccc uint %strlen(sbyte*)
 declare ccc void %llvm.memsetPOSTFIX(sbyte*, ubyte, UWORD, UWORD)
 declare ccc void %llvm.memcpyPOSTFIX(sbyte*, sbyte*, UWORD, UWORD)
@@ -21,13 +17,6 @@
     ret WORD %size
 }
 
-internal fastcc int %RPyExceptionOccurred() {
-    %tmp.0 = load %RPYTHON_EXCEPTION_VTABLE** %last_exception_type
-    %bool_res = setne %RPYTHON_EXCEPTION_VTABLE* %tmp.0, null
-    %res = cast bool %bool_res to int
-    ret int %res
-}
-
 internal fastcc %RPyString* %RPyString_FromString(sbyte* %s) {
     %lenu      = call ccc uint %strlen(sbyte* %s)
     %lenuword  = cast uint %lenu to UWORD
@@ -79,25 +68,9 @@
 
 """
 
-from sys import maxint
-if maxint != 2**31-1:
-    extfunctions += """
-internal fastcc void %pypy_ll_raise_OSError__Signed(int %errno_0) {
-    %tmp = cast int %errno_0 to long
-    call fastcc void %pypy_ll_raise_OSError__Signed(long %tmp)
-    ret void
-}
-
-internal fastcc void %pypy__RPyListOfString_SetItem__listPtr_Signed_rpy_stringPtr(%RPyListOfString* %l_1, int %index_0, %RPyString* %newstring_0) {
-    %index_0_long = cast int %index_0 to long
-    call fastcc void %pypy__RPyListOfString_SetItem__listPtr_Signed_rpy_stringPtr(%RPyListOfString* %l_1, long %index_0_long, %RPyString* %newstring_0)
-    ret void
-}
-
-"""
-
 extfunctions_standalone = """
 """
+from sys import maxint
 if maxint != 2**31-1:
     extfunctions_standalone += """
 internal fastcc int %pypy_entry_point(%RPyListOfString* %argv) {
@@ -108,15 +81,12 @@
 
 """
 
+
 def write_raise_exc(c_name, exc_repr, codewriter):
 
     l = """
 internal fastcc void %%raise%s(sbyte* %%msg) {
-    %%exception_value = cast %s to %%RPYTHON_EXCEPTION*
-    %%tmp             = getelementptr %%RPYTHON_EXCEPTION* %%exception_value, int 0, uint 0
-    %%exception_type  = load %%RPYTHON_EXCEPTION_VTABLE** %%tmp
-    store %%RPYTHON_EXCEPTION_VTABLE* %%exception_type, %%RPYTHON_EXCEPTION_VTABLE** %%last_exception_type
-    store %%RPYTHON_EXCEPTION* %%exception_value, %%RPYTHON_EXCEPTION** %%last_exception_value
+    ;%%exception_value = cast %s to %%RPYTHON_EXCEPTION*
     ret void
 }
 """ % (c_name, exc_repr)



More information about the Pypy-commit mailing list