[pypy-svn] r14949 - pypy/dist/pypy/translator/llvm2

ericvrp at codespeak.net ericvrp at codespeak.net
Sat Jul 23 01:41:29 CEST 2005


Author: ericvrp
Date: Sat Jul 23 01:41:28 2005
New Revision: 14949

Modified:
   pypy/dist/pypy/translator/llvm2/extfunction.py
   pypy/dist/pypy/translator/llvm2/funcnode.py
Log:
storing raised exception type and value in a global variable (throught some ugly casting for now)


Modified: pypy/dist/pypy/translator/llvm2/extfunction.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/extfunction.py	(original)
+++ pypy/dist/pypy/translator/llvm2/extfunction.py	Sat Jul 23 01:41:28 2005
@@ -14,6 +14,8 @@
 
 %st.rpy_string.0 = type {int, {int, [0 x sbyte]}}
 
+%last_exception_type  = global long 0
+%last_exception_value = global long 0
 """
 
 gc_boehm = """

Modified: pypy/dist/pypy/translator/llvm2/funcnode.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/funcnode.py	(original)
+++ pypy/dist/pypy/translator/llvm2/funcnode.py	Sat Jul 23 01:41:28 2005
@@ -153,4 +153,19 @@
             codewriter.ret_void()
 
     def write_exceptblock(self, codewriter, block):
+        assert len(block.inputargs) == 2
+        self.write_block_phi_nodes(codewriter, block)
+        inputargs = self.db.repr_arg_multi(block.inputargs)
+        inputargtypes = self.db.repr_arg_type_multi(block.inputargs)
+
+        #XXX add pending last_exception global here
+        t = 'long'  #void*
+        tmpvar = self.db.repr_tmpvar()
+        codewriter.cast(tmpvar, inputargtypes[0], inputargs[0], t)
+        codewriter.store(t, tmpvar, 'last_exception_type')
+
+        tmpvar = self.db.repr_tmpvar()
+        codewriter.cast(tmpvar, inputargtypes[1], inputargs[1], t)
+        codewriter.store(t, tmpvar, 'last_exception_value')
+
         codewriter.unwind()



More information about the Pypy-commit mailing list