Re: [Mingw-users] GCC 4.3.0 20080502 (alpha) Released - Please help us test it!
- Date: Wed, 07 May 2008 19:49:53 -0500
- From: "Aaron W. LaFramboise" <aaron77thyme@xxxxxxxxxxx>
- Subject: Re: [Mingw-users] GCC 4.3.0 20080502 (alpha) Released - Please help us test it!
ATS wrote:
> One thing that I've found very useful is to translate Unix signals
> into C++ exceptions (from GCC 4.2 this is supported on Linux). One
> gets semantics very close to what MS VC++:
>
> try {
> *(int*)0 = 0;
> } catch ( SignalException* pse ) {
> printf( "Exception condition: %s\n", pse->GetReason() );
> }
>
Thanks for pointing this out. Just off the top of my head, there is
some chance we can make this work with MinGW GCC as well. I'll look
into it.
> This provides a safety net when loading plugins or other running other
> code that one has not built oneself. Without a mechanism like this, the
> app is doomed whenever 3rd party code does a NULL pointer access or
> divide by zero. For me this is a crucial feature.
MinGW can do it presently using the 'manual' SEH interface in <expt.h>,
but it isn't nearly as pretty.
> As I see it the either-or debate (SJLJ/DWARF) is a bit limiting. SJLJ
> is slow because it does a complete CPU state save (FPU, MMX?, SSE?).
> This is needed when saving thread context. However, jumping into a
> catch block, it is way too much.
...
> My vote would be for a light weight state exception mechanism for Windows.
> It is not affected by foreign frames, is quite fast and small. It would
> be per thread. A decent interface / binding with SEH on top of that would
> be a bonus.
I think SEH might be close that 'light weight' mechanism you propose, as
it doesn't save state, and uses a per-thread mechanism.
Unfortunately, MinGW maintainers do not have the resources to write a
new exception model; we don't even have resources to implement SEH, a
frequently-demanded feature.
However, the problem is not that the exception throwing or catching is
slow. The problem is that merely passing through a try {} block or
exception specification such as throw(std::bad_alloc) has a small
penalty, which can be measurable in tight loops. DW2 completely solves
the problem, by having no direct runtime cost at all.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users