[D-runtime] druntime commit, revision 459
Don Clugston
dclugston at googlemail.com
Fri Jan 7 23:29:34 PST 2011
On 29 December 2010 00:08, Sean Kelly <sean at invisibleduck.org> wrote:
> On Dec 28, 2010, at 12:17 PM, Don Clugston wrote:
>
>> On 28 December 2010 19:34, Sean Kelly <sean at invisibleduck.org> wrote:
>>> This one was discussed a while ago in private email and stalled for lack of an executive decision. I'll paste some pertinent bits of the discussion below (all stuff I said). The rest of this message is pasted from various old emails.
>>
>> That's good to know. So the Linux behaviour is also believed to be
>> incorrect, but in a different way?
>
> Yes. Basically, having an exception thrown when another is in flight can't replace the in flight exception or chain with it, or things break in different, subtle ways (old D behavior was replacement, new D behavior was to be chaining).
Now that I've fixed the Windows SEH implementation so that finally
clauses are always called, the TDPL behaviour can be implemented quite
easily.
All that needs to happen is to move the chaining from the catch
handler, into the collision handler.
So, chaining occurs only when two uncaught exceptions have reached the
same finally or catch clause. (It's OK to have two in flight at the
same time, as long as they don't collide). No changes to the compiler
are required, and there's no need to track where the exception is
thrown. I'm actually quite impressed with SEH, it's a very clever
design. I never had any desire to understand Windows SEH, but it's Too
Late Now.
There are only a couple of problems:
* _d_setUnhandled() isn't much use, because we need the Windows
EXCEPTION_RECORD structure for the exception in flight, not the D
exception.
The semantics of that function need to change anyway, I think, if it's
a user-accessable function.
* I have no idea how exception handling works on Linux/OSX. So I
don't know how hard the TDPL behaviour will be to implement for them,
and what it will look like. But having a working Windows
implementation might help you.
Should I implement the TDPL behaviour for Windows, and check it in?
-Don.
More information about the D-runtime
mailing list