[LLVMdev] Implementing try/catch/finally

Talin viridia at gmail.com
Mon Apr 21 01:31:10 PDT 2008

Duncan Sands wrote:
>> One approach would be to simply duplicate the code in the 'finally' 
>> block for each exit, but that seems sub-optimal. It would be better, I 
>> think, to set a state variable before entering the 'finally' block, and 
>> then have it do a switch instruction at the end and transfer to the 
>> appropriate block.
> I think gcc just duplicates the block (see tree-eh.c).  I suggest that
> to start with you do the same, because it is simple to do, and then once
> everything is working well look into improving the code quality.
> Ciao,
> Duncan.

After doing some more research, I noticed that Java uses a jsr to 
implement 'finally', at least according to this document:


-- Talin

More information about the llvm-dev mailing list