Re: generating functions and eh region

2009-04-06 Thread Hans-Peter Nilsson
On Fri, 3 Apr 2009, Ian Lance Taylor wrote: gcc's -fasynchronous-unwind-tables option is intended to support unwinding the stack at any precise instruction boundary, which might be adequate for this purpose if the OS can handle the adjustment from an exception in the middle of an instruction

Re: generating functions and eh region

2009-04-06 Thread Ian Lance Taylor
Hans-Peter Nilsson h...@bitrange.com writes: On Fri, 3 Apr 2009, Ian Lance Taylor wrote: gcc's -fasynchronous-unwind-tables option is intended to support unwinding the stack at any precise instruction boundary, which might be adequate for this purpose if the OS can handle the adjustment from

Re: generating functions and eh region

2009-04-03 Thread Dave Korn
Cary Coutant wrote: With SEH you can catch that kind of errors and that's why it's so interesting in embedded world That's also why SEH is a major pain for optimization. The compiler would have to identify every instruction that may trigger an exception, Isn't that what the __try block

Re: generating functions and eh region

2009-04-03 Thread Vincent R.
On Fri, 03 Apr 2009 08:00:33 +0100, Dave Korn dave.korn.cyg...@googlemail.com wrote: Cary Coutant wrote: With SEH you can catch that kind of errors and that's why it's so interesting in embedded world That's also why SEH is a major pain for optimization. The compiler would have to identify

Re: generating functions and eh region

2009-04-03 Thread Dave Korn
Vincent R. wrote: Really, it's all pretty much the same as DW2, except that rather than calling a raise exception function in libgcc, it begins with a real processor exception that then ends up routing into the unwinder. From there it's all fairly analagous. I should have added that the

Re: generating functions and eh region

2009-04-03 Thread Ian Lance Taylor
Dave Korn dave.korn.cyg...@googlemail.com writes: Really, it's all pretty much the same as DW2, except that rather than calling a raise exception function in libgcc, it begins with a real processor exception that then ends up routing into the unwinder. From there it's all fairly analagous.

Re: generating functions and eh region

2009-04-03 Thread Ian Lance Taylor
Vincent R. foru...@smartmobili.com writes: Once again what I describe above is simplified because when seh is used, there is a mechanism called virtual unwiding that I didn't explained but that is the reason to store the prologue length. It's worth noting that in gcc the prologue length is

Re: generating functions and eh region

2009-04-03 Thread Dave Korn
Ian Lance Taylor wrote: First, an exception can occur while executing an instruction which accesses memory or does a division (admittedly only within a __try block). The raise exception call, on the other hand, can only occur during a function call. gcc's -fasynchronous-unwind-tables option

Re: generating functions and eh region

2009-04-03 Thread Ian Lance Taylor
Dave Korn dave.korn.cyg...@googlemail.com writes: Ian Lance Taylor wrote: First, an exception can occur while executing an instruction which accesses memory or does a division (admittedly only within a __try block). The raise exception call, on the other hand, can only occur during a

Re: generating functions and eh region

2009-04-03 Thread Kai Tietz
2009/4/3 Ian Lance Taylor i...@google.com: Vincent R. foru...@smartmobili.com writes: Once again what I describe above is simplified because when seh is used, there is a mechanism called virtual unwiding that I didn't explained but that is  the reason to store the prologue length. It's

Re: generating functions and eh region

2009-04-03 Thread Dave Korn
Ian Lance Taylor wrote: No fundamental difficulty that I know of. Lots of tedious work for every backend setting RTX_FRAME_RELATED_P and adding REG_FRAME_RELATED_EXPR notes to the manually constructed epilogue insns. And, in fact, I was wrong in saying that exception could only occur

Re: generating functions and eh region

2009-04-03 Thread Ian Lance Taylor
Dave Korn dave.korn.cyg...@googlemail.com writes: Ian Lance Taylor wrote: No fundamental difficulty that I know of. Lots of tedious work for every backend setting RTX_FRAME_RELATED_P and adding REG_FRAME_RELATED_EXPR notes to the manually constructed epilogue insns. And, in fact, I was

Re: generating functions and eh region

2009-04-03 Thread Nathan Froyd
On Fri, Apr 03, 2009 at 08:05:47PM +0100, Dave Korn wrote: Ian Lance Taylor wrote: No fundamental difficulty that I know of. Lots of tedious work for every backend setting RTX_FRAME_RELATED_P and adding REG_FRAME_RELATED_EXPR notes to the manually constructed epilogue insns. I think

Re: generating functions and eh region

2009-04-03 Thread Dave Korn
Ian Lance Taylor wrote: Also, windows doesn't have signal handlers. Except on Cygwin, which would have to deal with this in its own way. Does Windows have any asynchronous signalling mechanism which can trigger an SEH-style exception? Or does SEH only trigger on a certain class of

Re: generating functions and eh region

2009-04-03 Thread Dave Korn
Nathan Froyd wrote: If you're going to seriously consider doing this, you may want to take: http://gcc.gnu.org/ml/gcc-patches/2006-02/msg01091.html as a starting point. I certainly might, thank you ! cheers, DaveK

Re: generating functions and eh region

2009-04-02 Thread Vincent R.
On Wed, 01 Apr 2009 11:22:22 -0700, Ian Lance Taylor i...@google.com wrote: Vincent R. foru...@smartmobili.com writes: gcc will do the right thing if you put statements in an exception region. Hum how gcc can do that kind of things, is it some kind of voodoo ? __except is not implemented

Re: generating functions and eh region

2009-04-02 Thread Cary Coutant
With SEH you can catch that kind of errors and that's why it's so interesting in embedded world That's also why SEH is a major pain for optimization. The compiler would have to identify every instruction that may trigger an exception, and either treat that instruction as a scheduling boundary

generating functions and eh region

2009-04-01 Thread Vincent R.
Sorry to cross-post here because I have started this discussion on gcc-help but since we are trying to interest people about seh exceptions it might be better to do it here. I first asked how to take some instructions and generate a function with them, so I wanted to know if start_function was the

Re: generating functions and eh region

2009-04-01 Thread Ian Lance Taylor
Vincent R. foru...@smartmobili.com writes: Now the question is can we declare a function with an eh region and will it construct prologue and epilogue ? The instructions are already in a function. Why do you need a separate prologue and epilogue for them? Maybe I am missing the point here.

Re: generating functions and eh region

2009-04-01 Thread Vincent R.
On Wed, 01 Apr 2009 07:54:20 -0700, Ian Lance Taylor i...@google.com wrote: Vincent R. foru...@smartmobili.com writes: Now the question is can we declare a function with an eh region and will it construct prologue and epilogue ? The instructions are already in a function. Why do you need

Re: generating functions and eh region

2009-04-01 Thread Ian Lance Taylor
Vincent R. foru...@smartmobili.com writes: Yes I think I don't explain things very clearly, so what is important to know is that the __except keyword can be passed instructions(case 1) or directly a function(case 2). I see that but I don't see why it matters. in the case 1) ie if you

Re: generating functions and eh region

2009-04-01 Thread Vincent R.
On Wed, 01 Apr 2009 08:56:49 -0700, Ian Lance Taylor i...@google.com wrote: Vincent R. foru...@smartmobili.com writes: Yes I think I don't explain things very clearly, so what is important to know is that the __except keyword can be passed instructions(case 1) or directly a function(case 2).

Re: generating functions and eh region

2009-04-01 Thread Ian Lance Taylor
Vincent R. foru...@smartmobili.com writes: gcc will do the right thing if you put statements in an exception region. Hum how gcc can do that kind of things, is it some kind of voodoo ? __except is not implemented yet and is more than a language construct because it's an OS thing. So