[LLVMdev] Requirements for the EH representation
John McCall
rjmccall at apple.com
Tue May 10 22:46:02 PDT 2011
On May 5, 2011, at 10:50 PM, Charllls Alquarra wrote:
> On Apr 13, 2011, at 21:43 CDT, John McCall wrote:
>> And it's okay to have limited goals! I personally don't; I think we
>> should aim to get the IR design good enough to support crazy resumptive
>> languages with crazy custom unwinding schemes. But I need to know what
>> range of problems we're willing to consider solving before I can usefully
>> weigh different solutions.
>
> I will dare a comment on this topic well over my head, so my answer will probably only reflect my ignorance on the deepness of the subject, however, in any case i hope to get some clarification of my concepts
>
> let me say more before i go into the idea on this post: I've used coroutines a lot in my c++ programming, and certainly when you work a lot of time with a hammer, everything starts looking like a nail.
>
> However, it has always seemed to me that exception handling (at least on c++) is just a particular syntax of a subset of coroutine semantics:
This is certainly one way of implementing exceptions. Unfortunately, it would be prohibitively expensive to create a new coroutine every time a new EH scope is entered — much worse than other explicit scope-tracking implementations like SEH or builtin_sj/lj.
That said, lowering IR from a "conventional" style — where cleanups appear as normal code and control dependencies are expressed directly with normal-ish control flow — to the form required by an SEH-like implementation would indeed require operations not fundamentally dissimilar from coroutine extraction.
John.
More information about the llvm-dev
mailing list