[LLVMdev] OCaml and Exceptions

Chris Lattner clattner at apple.com
Sun Nov 25 17:01:13 PST 2007


>> Note that there is nothing in LLVM that prevents alternative  
>> exception
>> handling regimes, they just won't benefit from the existing
>> infrastructure, and will not interoperate with the DWARF runtime.
>
> Ok. Might as well start by reusing as much as possible. Exceptions  
> are very
> common in OCaml though. Is my 6x result a fair quantitative estimate  
> of how
> much faster exceptions could be make in this system for my compiler  
> if it
> were customized?

If Ocaml has no landing pads, and if "catch" blocks are infrequent, it  
would be very reasonable to implement them in terms of setjmp and  
longjmp (as Gordon is alluding to).  This is pretty straight-forward  
to do, and lets you evaluate the cost tradeoff. The nice thing about  
LLVM is that it doesn't force you to pick one specific implementation  
strategy, you can use the one that makes the most sense for your  
language.

-Chris



More information about the llvm-dev mailing list