From: Ranjit M. <rm...@vs...> - 2002-11-01 18:38:49
|
Ranjit Mathew wrote: > Danny Smith wrote: > > Another gotcha in the Dwarf2 vs sjlj story. I am leaning more and more > > towards a reversion of Dwarf2 eh to sjlj for mingw (ASAP,ie with next > > release of 3.2.x series) , but will await the sage consensus of cygwin > > and mingw devlprs. > > Yes, if sjlj works even in this case, it makes sense to switch > to it rather than running into all these errors. That however > would mean that methods with "try" blocks become expensive > even if no exception is ever thrown... :-( A nice article explaining the basics of how EH is implemented, how sjlj fares against dwarf2, etc. can be found at: http://www.usenix.org/events/osdi2000/wiess2000/full_papers/dinechin/dinechin_html/ SJLJ seems to incur more than just the extra calls to setjmp( ) in every try block - because of the nature of exceptions, the compiler can not perform a lot of the common optimisations it usually can (see the paper for details) if SJLJ is used - DW2 allows a very neat way out of this dilemma for the compiler. I'm really impressed! A real nice intro to DW2 implementation can be found in: http://gcc.gnu.org/ml/gcc/2002-07/msg00391.html > Some observations: > > 1. Happens only if -fomit-frame-pointer is specified. > 2. Does not happen if only -momit-leaf-frame-pointer is specified. > 3. Does not happen if the called function does not take any args. > 4. The generated ASM code shows sane procedure call frame > setup/cleanup w.r.t. the ESP and EBP registers. Another observation is that GCC 3.2 on Linux does not suffer from this problem at all! That should mean that the GCC 3.2 emits correct FDEs (at least on Linux) w.r.t. stdcall and -fomit-frame-pointers - there's some SNAFU then in the unwinding code for MinGW. Or maybe I'm missing something yet again. :-( BTW, the "-S -dA -dp" flags to g++ can be used to produce an assembler output of the program nicely showing the generated code, the exception table, FDEs, etc. Great for trying to understand how DW2 is implemented. Sincerely Yours, Ranjit. -- Ranjit Mathew Email: rmathew AT hotmail DOT com Bangalore, INDIA. Web: http://ranjitmathew.tripod.com/ |