On Dec 1, 2010, at 12:10 AM, John McCall wrote:> On Nov 30, 2010, at 11:04 PM, Bill Wendling wrote: >> • A landing pad must have exactly one dispatch instruction associated with it, >> and it must dominate that instruction. > > Okay, but how do we find it? >We can modify the dispatch to point back to the landing pad it's associated with. Something like: lpad: landingpad dispatch region label %lpad ... or similar.> Looks good, though! >Thanks! -bw
On Dec 1, 2010, at 12:15 AM, Bill Wendling wrote:> On Dec 1, 2010, at 12:10 AM, John McCall wrote: > >> On Nov 30, 2010, at 11:04 PM, Bill Wendling wrote: >>> • A landing pad must have exactly one dispatch instruction associated with it, >>> and it must dominate that instruction. >> >> Okay, but how do we find it? >> > We can modify the dispatch to point back to the landing pad it's associated with. Something like: > > lpad: landingpad > dispatch region label %lpad ... > > or similar.Okay. So passes (like codegen's EH preparation) that want to track what landing pads go to what dispatches will just have to walk the basic blocks and look for blocks terminated in "dispatch"? That seems mostly reasonable. One problem I foresee is that it's possible for a dispatch block to become unreachable from its landing pad. If that block is then deleted, we'd lose information about what's supposed to unwind there. This could happen if, e.g., someone had a noreturn destructor. In languages that usefully allow throws from EH destructors (i.e. Ada) I can imagine uses for this, and regardless it's well-formed code that shouldn't cause the world to explode. John.
On 01.12.2010 09:25, John McCall wrote:> > One problem I foresee is that it's possible for a dispatch block to become unreachable from its landing pad. If that block is then deleted, we'd lose information about what's supposed to unwind there. This could happen if, e.g., someone had a noreturn destructor. In languages that usefully allow throws from EH destructors (i.e. Ada) I can imagine uses for this, and regardless it's well-formed code that shouldn't cause the world to explode.The way I understood Duncan's description of the Ada model, even an unconditionally throwing Ada constructor isn't exactly noreturn - or rather, every destructor is surrounded by its own try-catch. Same in D, btw, which also allows throwing destructors. There, a throw with an in-flight exception appends the new exception to the in-flight chain of exceptions and keeps unwinding. Sebastian