Boost logo

Boost :

From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2008-04-15 14:24:01


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 15 April 2008 13:19 pm, Sebastian Redl wrote:
> Peter Dimov wrote:
> > Note that N2179 doesn't require a copy to be made. If GCC allocates the
> > exception objects on a heap - I have some recollections that it was doing
> > that but I may be wrong - it might still be possible to implement
> > current_exception to return a pointer to the active exception object...
> > if there's a way to insert a reference count somewhere inside.
>
> I took a larger stab at this, but I'm pretty much stumped right now. I
> can't abuse the reference count in __cxa_exception, because if I do, the
> handled exception stack won't be properly cleaned up.

I've never worked with compiler-internal kinds of things, but here's my
attempt at a helpful suggestion. Instead of modifying the reference count,
is it possible to do anything with the
__cxa_exception::unwindHeader.exception_cleanup function pointer? Maybe you
could replace it with something that doesn't actually destroy the exception
object, and then have the exception_ptr take ownership. You also have access
to the exception's destructor with the __cxa_exception::exceptionDestructor
function pointer, although I think even if you replaced this with a null
destructor, it would still free the memory for the exception object.

- --
Frank
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIBPLC5vihyNWuA4URAsrMAJ99mt85DsrRedUc/Bqr19CZsLaN6ACdFk6a
vojRZ2JNmY+cm+dMwsNCT9c=
=6g1K
-----END PGP SIGNATURE-----


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk