[LLVMdev] An alternate implementation of exceptions

Cédric Venet cedric.venet at laposte.net
Fri Sep 4 06:44:48 PDT 2009


> Thanks for looking at my stuff and I can only say that I am HAPPY that
> this method is already known.  I have not seen it implemented in any of
> the compilers I use, but the most important thing for me is just that the
> method is so great -- about four to five times faster than the traditional
> stack unwind method (try expands to setjmp, throw expands to longjmp) --
> that I wanted to make sure that somebody somewhere knew about the method.
>   

C++ exception implementation are optimized for the case where no 
exception is throw (opposite to what is done in python or maybe in 
java). Because in C++ exception are exceptionnal and should not be 
thrown during a normal execution of a program (use return code in this 
case). At least this is what all the C++ guru preach (that I know of).
I don't think your implementation can be faster than current zero cost 
exception model used currently (where metainformation is added somewhere 
for unwinding, but no other code is needed) in the case of no exception 
throw. And like I said, in the other case we don't care much about 
speed, since it is an exceptional occurrence.

This is just the way I see it, but at least for C++, the current 
solution seems more appropriate. obviously, for language like python 
which use exception to exit loop, this isn't the same thinks at all.

just my 2cents

Cédric



More information about the llvm-dev mailing list