[LLVMdev] RFC: Exception Handling Proposal II
Bill Wendling
wendling at apple.com
Wed Nov 24 05:36:56 PST 2010
On Nov 24, 2010, at 4:58 AM, John McCall wrote:
>> If that's so, how do you encode which which landing pad is to be
>> followed per region?
>>
>> Consider the following code:
>>
>> try {
>> Foo f();
>> f.run(); // can throw exception
>> Bar b();
>> b.run(); // can throw exception
>> Baz z();
>> z.run(); // can throw exception
>> } catch (...) {
>> }
>
> I assume you don't mean these to be function declarations. :)
>
>> The object 'f' is in a different cleanup area than 'b' which, in turn
>> is in a different area than 'z'. These three regions should point to
>> three different landing pads (or different offsets in the same landing
>> pad), which (I believe) are encoded in IR by being declared after
>> different dispatch instructions, all of which within the same region.
>
> Nope. Three regions, three landing pads, three dispatch instructions.
> (actually four if Foo::Foo() can throw). The Baz-destructing region
> chains to the Bar-destructing region which chains to the Foo-destructing
> region which chains to the catching region; the first three are
> cleanup-only.
>
Ah ha! I think I had a different mental model than you did. Or at least I remembered things differently from the discussion. :-) For me, there is one dispatch per region, which is why I had the region number associated with the invokes as well as the "unwind to" edge coming from them. (See my response to Renato for a description.) I'll think more about your model...
>> If that's so, why do you still have the invoke call? Why should you
>> treat call-exceptions any differently than instruction-exceptions?
>
> One of my favorite things about this design is that it's totally
> independent of what exactly is allowed to throw. I'm really not sure
> how best to represent other throwing instructions, except that I'm
> pretty confident that we don't want anything as heavyweight as
> invoke. There's a pretty broad range of possibilities — we could
> make invoke-like instructions for all of them (ick...), or we could
> tag individual instructions with regions, or we could mark basic
> blocks as unwinding to particular places. But we can wrestle
> with that independently of deciding to adopt explicitly-chained
> landing pads.
>
Exactly! :-)
-bw
More information about the llvm-dev
mailing list