Re: [RFC / musing] Scoped exception handling in Linux userspace?

2013-07-19 Thread Andy Lutomirski
On Fri, Jul 19, 2013 at 9:22 AM, David Daney wrote: > On 07/18/2013 08:29 PM, Andy Lutomirski wrote: >> >> Other way around: a *library* that wants to use exception handling >> can't do so safely without the cooperation, or at least understanding, >> of the main program and every other library tha

Re: [RFC / musing] Scoped exception handling in Linux userspace?

2013-07-19 Thread Joseph S. Myers
On Thu, 18 Jul 2013, Andy Lutomirski wrote: > 2. It's localized. So you can mmap something, read from it *and > handle SIGBUS*, and unmap. There is of course no guarantee that possibly faulting memory accesses are preserved (GCC should never introduce such an access where it wouldn't occur in

Re: [RFC / musing] Scoped exception handling in Linux userspace?

2013-07-19 Thread David Daney
On 07/18/2013 08:29 PM, Andy Lutomirski wrote: On Thu, Jul 18, 2013 at 6:17 PM, David Daney wrote: On 07/18/2013 05:50 PM, Andy Lutomirski wrote: On Thu, Jul 18, 2013 at 5:40 PM, David Daney wrote: On 07/18/2013 05:26 PM, Andy Lutomirski wrote: How is this different than throwing excepti

Re: [RFC / musing] Scoped exception handling in Linux userspace?

2013-07-18 Thread Tristan Gingold
On Jul 19, 2013, at 2:26 AM, Andy Lutomirski wrote: > Windows has a feature that I've wanted on Linux forever: stack-based > (i.e. scoped) exception handling. The upshot is that you can do, > roughly, this (pseudocode): [...] Indeed Windows and OpenVMS have such a mechanism. That's clean and l

Re: [RFC / musing] Scoped exception handling in Linux userspace?

2013-07-18 Thread Andy Lutomirski
On Thu, Jul 18, 2013 at 6:17 PM, David Daney wrote: > On 07/18/2013 05:50 PM, Andy Lutomirski wrote: >> >> On Thu, Jul 18, 2013 at 5:40 PM, David Daney >> wrote: >>> >>> On 07/18/2013 05:26 PM, Andy Lutomirski wrote: >>> >>> >>> How is this different than throwing exceptions from a signal handler

Re: [RFC / musing] Scoped exception handling in Linux userspace?

2013-07-18 Thread David Daney
On 07/18/2013 05:50 PM, Andy Lutomirski wrote: On Thu, Jul 18, 2013 at 5:40 PM, David Daney wrote: On 07/18/2013 05:26 PM, Andy Lutomirski wrote: Windows has a feature that I've wanted on Linux forever: stack-based (i.e. scoped) exception handling. The upshot is that you can do, roughly, thi

Re: [RFC / musing] Scoped exception handling in Linux userspace?

2013-07-18 Thread Andy Lutomirski
On Thu, Jul 18, 2013 at 5:40 PM, David Daney wrote: > On 07/18/2013 05:26 PM, Andy Lutomirski wrote: >> >> Windows has a feature that I've wanted on Linux forever: stack-based >> (i.e. scoped) exception handling. The upshot is that you can do, >> roughly, this (pseudocode): >> >> int callback(...

Re: [RFC / musing] Scoped exception handling in Linux userspace?

2013-07-18 Thread David Daney
On 07/18/2013 05:26 PM, Andy Lutomirski wrote: Windows has a feature that I've wanted on Linux forever: stack-based (i.e. scoped) exception handling. The upshot is that you can do, roughly, this (pseudocode): int callback(...) { /* Called if code_that_may_fault faults. May return "unwind to

[RFC / musing] Scoped exception handling in Linux userspace?

2013-07-18 Thread Andy Lutomirski
Windows has a feature that I've wanted on Linux forever: stack-based (i.e. scoped) exception handling. The upshot is that you can do, roughly, this (pseudocode): int callback(...) { /* Called if code_that_may_fault faults. May return "unwind to landing pad", "propagate the fault", or "fixup an