RE: carbon throwing objc exceptions
RE: carbon throwing objc exceptions
- Subject: RE: carbon throwing objc exceptions
- From: Nathan Herring <email@hidden>
- Date: Tue, 15 Sep 2009 22:25:21 +0000
- Thread-topic: carbon throwing objc exceptions
One could imagine there being some flag set in new code that could perturb the operation of ObjC[++] unwinding s.t. the ObjC runtime creates thunks between old-style and new-style code that do the marshalling between libUnwind exceptions and setjmp/longjmp exceptions. Then you only really care about the cases where you used to have a callback written in C or some other not-unwindable language where you were quietly unwinding before and now you can't -- to which I argue that you could never have counted on that before, and depending on whether or not you own that code, was probably fragile anyway. (Like in OS n, it was a pure callback, and in os n+1, it created side effects that needed cleanup, and now you've broken it.)
-----Original Message-----
From: Greg Parker [mailto:email@hidden]
Sent: Tuesday, September 15, 2009 3:16 PM
To: Nathan Herring
Cc: Joel Reymont; Shawn Erickson; darwin dev
Subject: Re: carbon throwing objc exceptions
On Sep 15, 2009, at 2:58 PM, Nathan Herring wrote:
> I have separately made the suggestion, via rdar://7225898, that
> Apple move ObjC[++] to use libUnwind, so that callbacks of any kind
> would see this as a (possibly foreign) exception, and would either
> (1) terminate due to un-unwindability (rather than quietly unwind
> stack that cannot be unwound), (2) allow for standard exception
> handling, including catching and rethrowing for finally-like behavior.
That's unfortunately not binary-compatible with existing 32-bit Mac
binaries. Such code does not include the unwind tables that libunwind
needs to do its work, so exceptions that work today would almost
always terminate as un-unwindable.
iPhone and 64-bit Mac do have C++-compatible Objective-C exceptions
courtesy of libunwind. Objective-C exceptions run destructors and
`catch (...)` clauses, and C++ exceptions unlock `@synchronized` and
run `@catch (...)` and `@finally` clauses.
(But C++ and Objective-C exceptions are implemented with setjmp/
longjmp on iPhone OS, so you still get the same clumsy machine code
that started this whole thread.)
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden