2001-03-28 13:04:51 +02:00
|
|
|
// -*- C++ -*- Allocate exception objects.
|
2014-01-02 23:30:10 +01:00
|
|
|
// Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
2001-03-28 13:04:51 +02:00
|
|
|
//
|
Makefile.am, [...]: Replace "GNU CC" with "GCC".
2003-05-24 Nathanael Nerode <neroden@gcc.gnu.org>
* libsupc++/Makefile.am, libsupc++/cxxabi.h, libsupc++/del_op.cc,
libsupc++/del_opnt.cc, libsupc++/del_opv.cc, libsupc++/del_opvnt.cc,
libsupc++/eh_alloc.cc, libsupc++/eh_aux_runtime.cc,
libsupc++/eh_catch.cc, libsupc++/eh_exception.cc,
libsupc++/eh_globals.cc, libsupc++/eh_personality.cc,
libsupc++/eh_term_handler.cc, libsupc++/eh_terminate.cc,
libsupc++/eh_throw.cc, libsupc++/eh_type.cc,
libsupc++/eh_unex_handler.cc, libsupc++/exception,
libsupc++/new, libsupc++/new_handler.cc, libsupc++/new_op.cc,
libsupc++/new_opnt.cc, libsupc++/new_opv.cc, libsupc++/new_opvnt.cc,
libsupc++/pure.cc, libsupc++/tinfo.cc, libsupc++/tinfo2.cc,
libsupc++/typeinfo, libsupc++/unwind-cxx.h, libsupc++/vec.cc:
Replace "GNU CC" with "GCC".
From-SVN: r67155
2003-05-24 18:22:03 +02:00
|
|
|
// This file is part of GCC.
|
2001-03-28 13:04:51 +02:00
|
|
|
//
|
Makefile.am, [...]: Replace "GNU CC" with "GCC".
2003-05-24 Nathanael Nerode <neroden@gcc.gnu.org>
* libsupc++/Makefile.am, libsupc++/cxxabi.h, libsupc++/del_op.cc,
libsupc++/del_opnt.cc, libsupc++/del_opv.cc, libsupc++/del_opvnt.cc,
libsupc++/eh_alloc.cc, libsupc++/eh_aux_runtime.cc,
libsupc++/eh_catch.cc, libsupc++/eh_exception.cc,
libsupc++/eh_globals.cc, libsupc++/eh_personality.cc,
libsupc++/eh_term_handler.cc, libsupc++/eh_terminate.cc,
libsupc++/eh_throw.cc, libsupc++/eh_type.cc,
libsupc++/eh_unex_handler.cc, libsupc++/exception,
libsupc++/new, libsupc++/new_handler.cc, libsupc++/new_op.cc,
libsupc++/new_opnt.cc, libsupc++/new_opv.cc, libsupc++/new_opvnt.cc,
libsupc++/pure.cc, libsupc++/tinfo.cc, libsupc++/tinfo2.cc,
libsupc++/typeinfo, libsupc++/unwind-cxx.h, libsupc++/vec.cc:
Replace "GNU CC" with "GCC".
From-SVN: r67155
2003-05-24 18:22:03 +02:00
|
|
|
// GCC is free software; you can redistribute it and/or modify
|
2001-03-28 13:04:51 +02:00
|
|
|
// it under the terms of the GNU General Public License as published by
|
2009-04-09 17:00:19 +02:00
|
|
|
// the Free Software Foundation; either version 3, or (at your option)
|
2001-03-28 13:04:51 +02:00
|
|
|
// any later version.
|
|
|
|
//
|
Makefile.am, [...]: Replace "GNU CC" with "GCC".
2003-05-24 Nathanael Nerode <neroden@gcc.gnu.org>
* libsupc++/Makefile.am, libsupc++/cxxabi.h, libsupc++/del_op.cc,
libsupc++/del_opnt.cc, libsupc++/del_opv.cc, libsupc++/del_opvnt.cc,
libsupc++/eh_alloc.cc, libsupc++/eh_aux_runtime.cc,
libsupc++/eh_catch.cc, libsupc++/eh_exception.cc,
libsupc++/eh_globals.cc, libsupc++/eh_personality.cc,
libsupc++/eh_term_handler.cc, libsupc++/eh_terminate.cc,
libsupc++/eh_throw.cc, libsupc++/eh_type.cc,
libsupc++/eh_unex_handler.cc, libsupc++/exception,
libsupc++/new, libsupc++/new_handler.cc, libsupc++/new_op.cc,
libsupc++/new_opnt.cc, libsupc++/new_opv.cc, libsupc++/new_opvnt.cc,
libsupc++/pure.cc, libsupc++/tinfo.cc, libsupc++/tinfo2.cc,
libsupc++/typeinfo, libsupc++/unwind-cxx.h, libsupc++/vec.cc:
Replace "GNU CC" with "GCC".
From-SVN: r67155
2003-05-24 18:22:03 +02:00
|
|
|
// GCC is distributed in the hope that it will be useful,
|
2001-03-28 13:04:51 +02:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
2009-04-09 17:00:19 +02:00
|
|
|
// Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
// permissions described in the GCC Runtime Library Exception, version
|
|
|
|
// 3.1, as published by the Free Software Foundation.
|
2001-03-28 13:04:51 +02:00
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
// You should have received a copy of the GNU General Public License and
|
|
|
|
// a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
// <http://www.gnu.org/licenses/>.
|
2001-03-28 13:04:51 +02:00
|
|
|
|
|
|
|
// This is derived from the C++ ABI for IA-64. Where we diverge
|
|
|
|
// for cross-architecture compatibility are noted with "@@@".
|
|
|
|
|
2005-11-22 01:19:07 +01:00
|
|
|
#include <bits/c++config.h>
|
2001-03-28 13:04:51 +02:00
|
|
|
#include <cstdlib>
|
2004-08-02 22:28:22 +02:00
|
|
|
#if _GLIBCXX_HOSTED
|
2001-03-28 13:04:51 +02:00
|
|
|
#include <cstring>
|
2004-08-02 22:28:22 +02:00
|
|
|
#endif
|
2001-07-03 01:08:28 +02:00
|
|
|
#include <climits>
|
2002-06-19 17:19:53 +02:00
|
|
|
#include <exception>
|
2001-03-28 13:04:51 +02:00
|
|
|
#include "unwind-cxx.h"
|
2006-09-14 11:48:15 +02:00
|
|
|
#include <ext/concurrence.h>
|
2001-03-28 13:04:51 +02:00
|
|
|
|
2004-08-02 22:28:22 +02:00
|
|
|
#if _GLIBCXX_HOSTED
|
|
|
|
using std::free;
|
|
|
|
using std::malloc;
|
2006-05-10 17:43:20 +02:00
|
|
|
using std::memset;
|
2004-08-02 22:28:22 +02:00
|
|
|
#else
|
2005-12-19 01:56:05 +01:00
|
|
|
// In a freestanding environment, these functions may not be available
|
|
|
|
// -- but for now, we assume that they are.
|
2004-08-02 22:28:22 +02:00
|
|
|
extern "C" void *malloc (std::size_t);
|
|
|
|
extern "C" void free(void *);
|
2006-01-18 12:22:10 +01:00
|
|
|
extern "C" void *memset (void *, int, std::size_t);
|
2004-08-02 22:28:22 +02:00
|
|
|
#endif
|
2001-03-28 13:04:51 +02:00
|
|
|
|
2004-08-02 22:28:22 +02:00
|
|
|
using namespace __cxxabiv1;
|
2001-03-28 13:04:51 +02:00
|
|
|
|
|
|
|
// ??? How to control these parameters.
|
|
|
|
|
|
|
|
// Guess from the size of basic types how large a buffer is reasonable.
|
|
|
|
// Note that the basic c++ exception header has 13 pointers and 2 ints,
|
|
|
|
// so on a system with PSImode pointers we're talking about 56 bytes
|
|
|
|
// just for overhead.
|
|
|
|
|
|
|
|
#if INT_MAX == 32767
|
|
|
|
# define EMERGENCY_OBJ_SIZE 128
|
|
|
|
# define EMERGENCY_OBJ_COUNT 16
|
2012-12-21 11:12:48 +01:00
|
|
|
#elif !defined (_GLIBCXX_LLP64) && LONG_MAX == 2147483647
|
2001-03-28 13:04:51 +02:00
|
|
|
# define EMERGENCY_OBJ_SIZE 512
|
|
|
|
# define EMERGENCY_OBJ_COUNT 32
|
|
|
|
#else
|
|
|
|
# define EMERGENCY_OBJ_SIZE 1024
|
|
|
|
# define EMERGENCY_OBJ_COUNT 64
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __GTHREADS
|
|
|
|
# undef EMERGENCY_OBJ_COUNT
|
|
|
|
# define EMERGENCY_OBJ_COUNT 4
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if INT_MAX == 32767 || EMERGENCY_OBJ_COUNT <= 32
|
|
|
|
typedef unsigned int bitmask_type;
|
|
|
|
#else
|
2012-12-21 11:12:48 +01:00
|
|
|
#if defined (_GLIBCXX_LLP64)
|
|
|
|
typedef unsigned long long bitmask_type;
|
|
|
|
#else
|
2001-03-28 13:04:51 +02:00
|
|
|
typedef unsigned long bitmask_type;
|
|
|
|
#endif
|
2012-12-21 11:12:48 +01:00
|
|
|
#endif
|
2001-03-28 13:04:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
typedef char one_buffer[EMERGENCY_OBJ_SIZE] __attribute__((aligned));
|
|
|
|
static one_buffer emergency_buffer[EMERGENCY_OBJ_COUNT];
|
|
|
|
static bitmask_type emergency_used;
|
|
|
|
|
[multiple changes]
2008-08-23 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/lib/libstdc++.exp (check_v3_target_atomic_builtins): Add.
* testsuite/lib/dg-options.exp (dg-require-atomic-builtins): Likewise.
* testsuite/18_support/exception_ptr/current_exception.cc: Use it.
* testsuite/18_support/exception_ptr/rethrow_exception.cc: Likewise.
* testsuite/18_support/exception_ptr/lifespan.cc: Likewise.
2008-08-23 Sebastian Redl <sebastian.redl@getdesigned.at>
Add (again) exception propagation support as per N2179. Feature is
available only when _GLIBCXX_ATOMIC_BUILTINS_4 is defined.
* libsupc++/exception_ptr.h (exception_ptr, current_exception,
copy_exception, rethrow_exception): New file, implement exception
propagation.
* libsupc++/eh_ptr.cc (exception_ptr, current_exception,
rethrow_exception, __gxx_dependent_exception_cleanup): Likewise.
* libsupc++/unwind-cxx.h (__cxa_exception): Add reference count.
(__cxa_dependent_exception, __cxa_allocate_dependent_exception,
__cxa_free_dependent_exception, __get_dependent_exception_from_ue,
__GXX_INIT_DEPENDENT_EXCEPTION_CLASS, __is_dependent_exception,
__gxx_dependent_exception_class, __get_object_from_ue,
__get_object_from_ambiguous_exception): Add.
(__GXX_INIT_EXCEPTION_CLASS, __gxx_exception_class): Rename.
(__is_gxx_exception_class): Handle dependent exceptions.
* libsupc++/eh_arm.cc (__cxa_type_match): Likewise.
* libsupc++/eh_call.cc (__cxa_call_unexpected): Likewise.
* libsupc++/eh_personality.cc (__gxx_personality_*): Likewise.
* libsupc++/eh_type.cc (__cxa_current_exception_type): Likewise.
* libsupc++/eh_alloc.cc (__cxa_allocate_dependent_exception,
__cxa_free_dependent_exception): Add.
* libsupc++/eh_throw.cc (__gxx_exception_cleanup): Handle reference
counting.
* libsupc++/exception: Conditionally include exception_ptr.h.
* libsupc++/Makefile.am: Register new files.
* libsupc++/Makefile.in: Regenerate.
* config/abi/pre/gnu.ver: Add new symbols.
* testsuite/18_support/exception_ptr/current_exception.cc: Test the
core functionality of current_exception().
* testsuite/18_support/exception_ptr/rethrow_exception.cc: Test the
core functionality of rethrow_exception().
* testsuite/18_support/exception_ptr/lifespan.cc: Test the life span of
exception objects during exception propagation.
From-SVN: r139509
2008-08-23 13:28:30 +02:00
|
|
|
static __cxa_dependent_exception dependents_buffer[EMERGENCY_OBJ_COUNT];
|
|
|
|
static bitmask_type dependents_used;
|
|
|
|
|
2006-09-14 11:48:15 +02:00
|
|
|
namespace
|
2001-03-28 13:04:51 +02:00
|
|
|
{
|
2006-09-14 11:48:15 +02:00
|
|
|
// A single mutex controlling emergency allocations.
|
|
|
|
__gnu_cxx::__mutex emergency_mutex;
|
2001-03-28 13:04:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" void *
|
2011-10-10 21:03:39 +02:00
|
|
|
__cxxabiv1::__cxa_allocate_exception(std::size_t thrown_size) _GLIBCXX_NOTHROW
|
2001-03-28 13:04:51 +02:00
|
|
|
{
|
|
|
|
void *ret;
|
|
|
|
|
2009-01-07 23:50:42 +01:00
|
|
|
thrown_size += sizeof (__cxa_refcounted_exception);
|
2004-08-02 22:28:22 +02:00
|
|
|
ret = malloc (thrown_size);
|
2001-03-28 13:04:51 +02:00
|
|
|
|
|
|
|
if (! ret)
|
|
|
|
{
|
2006-09-14 11:48:15 +02:00
|
|
|
__gnu_cxx::__scoped_lock sentry(emergency_mutex);
|
2001-03-28 13:04:51 +02:00
|
|
|
|
|
|
|
bitmask_type used = emergency_used;
|
|
|
|
unsigned int which = 0;
|
|
|
|
|
2001-04-12 09:47:34 +02:00
|
|
|
if (thrown_size > EMERGENCY_OBJ_SIZE)
|
|
|
|
goto failed;
|
2001-03-28 13:04:51 +02:00
|
|
|
while (used & 1)
|
|
|
|
{
|
|
|
|
used >>= 1;
|
|
|
|
if (++which >= EMERGENCY_OBJ_COUNT)
|
2001-04-12 09:47:34 +02:00
|
|
|
goto failed;
|
2001-03-28 13:04:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
emergency_used |= (bitmask_type)1 << which;
|
|
|
|
ret = &emergency_buffer[which][0];
|
|
|
|
|
2001-04-12 09:47:34 +02:00
|
|
|
failed:;
|
2006-09-14 11:48:15 +02:00
|
|
|
|
2001-04-12 09:47:34 +02:00
|
|
|
if (!ret)
|
|
|
|
std::terminate ();
|
2001-03-28 13:04:51 +02:00
|
|
|
}
|
|
|
|
|
2009-01-07 23:50:42 +01:00
|
|
|
memset (ret, 0, sizeof (__cxa_refcounted_exception));
|
2001-03-28 13:04:51 +02:00
|
|
|
|
2009-01-07 23:50:42 +01:00
|
|
|
return (void *)((char *)ret + sizeof (__cxa_refcounted_exception));
|
2001-03-28 13:04:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void
|
2011-10-10 21:03:39 +02:00
|
|
|
__cxxabiv1::__cxa_free_exception(void *vptr) _GLIBCXX_NOTHROW
|
2001-03-28 13:04:51 +02:00
|
|
|
{
|
2007-02-01 05:04:34 +01:00
|
|
|
char *base = (char *) emergency_buffer;
|
2001-03-28 13:04:51 +02:00
|
|
|
char *ptr = (char *) vptr;
|
2007-02-01 05:04:34 +01:00
|
|
|
if (ptr >= base
|
|
|
|
&& ptr < base + sizeof (emergency_buffer))
|
2001-03-28 13:04:51 +02:00
|
|
|
{
|
2006-09-14 11:48:15 +02:00
|
|
|
const unsigned int which
|
2007-02-01 05:04:34 +01:00
|
|
|
= (unsigned) (ptr - base) / EMERGENCY_OBJ_SIZE;
|
2001-03-28 13:04:51 +02:00
|
|
|
|
2006-09-14 11:48:15 +02:00
|
|
|
__gnu_cxx::__scoped_lock sentry(emergency_mutex);
|
2001-03-28 13:04:51 +02:00
|
|
|
emergency_used &= ~((bitmask_type)1 << which);
|
|
|
|
}
|
|
|
|
else
|
2009-01-07 23:50:42 +01:00
|
|
|
free (ptr - sizeof (__cxa_refcounted_exception));
|
2001-03-28 13:04:51 +02:00
|
|
|
}
|
[multiple changes]
2008-08-23 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/lib/libstdc++.exp (check_v3_target_atomic_builtins): Add.
* testsuite/lib/dg-options.exp (dg-require-atomic-builtins): Likewise.
* testsuite/18_support/exception_ptr/current_exception.cc: Use it.
* testsuite/18_support/exception_ptr/rethrow_exception.cc: Likewise.
* testsuite/18_support/exception_ptr/lifespan.cc: Likewise.
2008-08-23 Sebastian Redl <sebastian.redl@getdesigned.at>
Add (again) exception propagation support as per N2179. Feature is
available only when _GLIBCXX_ATOMIC_BUILTINS_4 is defined.
* libsupc++/exception_ptr.h (exception_ptr, current_exception,
copy_exception, rethrow_exception): New file, implement exception
propagation.
* libsupc++/eh_ptr.cc (exception_ptr, current_exception,
rethrow_exception, __gxx_dependent_exception_cleanup): Likewise.
* libsupc++/unwind-cxx.h (__cxa_exception): Add reference count.
(__cxa_dependent_exception, __cxa_allocate_dependent_exception,
__cxa_free_dependent_exception, __get_dependent_exception_from_ue,
__GXX_INIT_DEPENDENT_EXCEPTION_CLASS, __is_dependent_exception,
__gxx_dependent_exception_class, __get_object_from_ue,
__get_object_from_ambiguous_exception): Add.
(__GXX_INIT_EXCEPTION_CLASS, __gxx_exception_class): Rename.
(__is_gxx_exception_class): Handle dependent exceptions.
* libsupc++/eh_arm.cc (__cxa_type_match): Likewise.
* libsupc++/eh_call.cc (__cxa_call_unexpected): Likewise.
* libsupc++/eh_personality.cc (__gxx_personality_*): Likewise.
* libsupc++/eh_type.cc (__cxa_current_exception_type): Likewise.
* libsupc++/eh_alloc.cc (__cxa_allocate_dependent_exception,
__cxa_free_dependent_exception): Add.
* libsupc++/eh_throw.cc (__gxx_exception_cleanup): Handle reference
counting.
* libsupc++/exception: Conditionally include exception_ptr.h.
* libsupc++/Makefile.am: Register new files.
* libsupc++/Makefile.in: Regenerate.
* config/abi/pre/gnu.ver: Add new symbols.
* testsuite/18_support/exception_ptr/current_exception.cc: Test the
core functionality of current_exception().
* testsuite/18_support/exception_ptr/rethrow_exception.cc: Test the
core functionality of rethrow_exception().
* testsuite/18_support/exception_ptr/lifespan.cc: Test the life span of
exception objects during exception propagation.
From-SVN: r139509
2008-08-23 13:28:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
extern "C" __cxa_dependent_exception*
|
2011-10-10 21:03:39 +02:00
|
|
|
__cxxabiv1::__cxa_allocate_dependent_exception() _GLIBCXX_NOTHROW
|
[multiple changes]
2008-08-23 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/lib/libstdc++.exp (check_v3_target_atomic_builtins): Add.
* testsuite/lib/dg-options.exp (dg-require-atomic-builtins): Likewise.
* testsuite/18_support/exception_ptr/current_exception.cc: Use it.
* testsuite/18_support/exception_ptr/rethrow_exception.cc: Likewise.
* testsuite/18_support/exception_ptr/lifespan.cc: Likewise.
2008-08-23 Sebastian Redl <sebastian.redl@getdesigned.at>
Add (again) exception propagation support as per N2179. Feature is
available only when _GLIBCXX_ATOMIC_BUILTINS_4 is defined.
* libsupc++/exception_ptr.h (exception_ptr, current_exception,
copy_exception, rethrow_exception): New file, implement exception
propagation.
* libsupc++/eh_ptr.cc (exception_ptr, current_exception,
rethrow_exception, __gxx_dependent_exception_cleanup): Likewise.
* libsupc++/unwind-cxx.h (__cxa_exception): Add reference count.
(__cxa_dependent_exception, __cxa_allocate_dependent_exception,
__cxa_free_dependent_exception, __get_dependent_exception_from_ue,
__GXX_INIT_DEPENDENT_EXCEPTION_CLASS, __is_dependent_exception,
__gxx_dependent_exception_class, __get_object_from_ue,
__get_object_from_ambiguous_exception): Add.
(__GXX_INIT_EXCEPTION_CLASS, __gxx_exception_class): Rename.
(__is_gxx_exception_class): Handle dependent exceptions.
* libsupc++/eh_arm.cc (__cxa_type_match): Likewise.
* libsupc++/eh_call.cc (__cxa_call_unexpected): Likewise.
* libsupc++/eh_personality.cc (__gxx_personality_*): Likewise.
* libsupc++/eh_type.cc (__cxa_current_exception_type): Likewise.
* libsupc++/eh_alloc.cc (__cxa_allocate_dependent_exception,
__cxa_free_dependent_exception): Add.
* libsupc++/eh_throw.cc (__gxx_exception_cleanup): Handle reference
counting.
* libsupc++/exception: Conditionally include exception_ptr.h.
* libsupc++/Makefile.am: Register new files.
* libsupc++/Makefile.in: Regenerate.
* config/abi/pre/gnu.ver: Add new symbols.
* testsuite/18_support/exception_ptr/current_exception.cc: Test the
core functionality of current_exception().
* testsuite/18_support/exception_ptr/rethrow_exception.cc: Test the
core functionality of rethrow_exception().
* testsuite/18_support/exception_ptr/lifespan.cc: Test the life span of
exception objects during exception propagation.
From-SVN: r139509
2008-08-23 13:28:30 +02:00
|
|
|
{
|
|
|
|
__cxa_dependent_exception *ret;
|
|
|
|
|
|
|
|
ret = static_cast<__cxa_dependent_exception*>
|
|
|
|
(malloc (sizeof (__cxa_dependent_exception)));
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
__gnu_cxx::__scoped_lock sentry(emergency_mutex);
|
|
|
|
|
|
|
|
bitmask_type used = dependents_used;
|
|
|
|
unsigned int which = 0;
|
|
|
|
|
|
|
|
while (used & 1)
|
|
|
|
{
|
|
|
|
used >>= 1;
|
|
|
|
if (++which >= EMERGENCY_OBJ_COUNT)
|
|
|
|
goto failed;
|
|
|
|
}
|
|
|
|
|
|
|
|
dependents_used |= (bitmask_type)1 << which;
|
|
|
|
ret = &dependents_buffer[which];
|
|
|
|
|
|
|
|
failed:;
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
std::terminate ();
|
|
|
|
}
|
|
|
|
|
|
|
|
memset (ret, 0, sizeof (__cxa_dependent_exception));
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void
|
|
|
|
__cxxabiv1::__cxa_free_dependent_exception
|
2011-10-10 21:03:39 +02:00
|
|
|
(__cxa_dependent_exception *vptr) _GLIBCXX_NOTHROW
|
[multiple changes]
2008-08-23 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/lib/libstdc++.exp (check_v3_target_atomic_builtins): Add.
* testsuite/lib/dg-options.exp (dg-require-atomic-builtins): Likewise.
* testsuite/18_support/exception_ptr/current_exception.cc: Use it.
* testsuite/18_support/exception_ptr/rethrow_exception.cc: Likewise.
* testsuite/18_support/exception_ptr/lifespan.cc: Likewise.
2008-08-23 Sebastian Redl <sebastian.redl@getdesigned.at>
Add (again) exception propagation support as per N2179. Feature is
available only when _GLIBCXX_ATOMIC_BUILTINS_4 is defined.
* libsupc++/exception_ptr.h (exception_ptr, current_exception,
copy_exception, rethrow_exception): New file, implement exception
propagation.
* libsupc++/eh_ptr.cc (exception_ptr, current_exception,
rethrow_exception, __gxx_dependent_exception_cleanup): Likewise.
* libsupc++/unwind-cxx.h (__cxa_exception): Add reference count.
(__cxa_dependent_exception, __cxa_allocate_dependent_exception,
__cxa_free_dependent_exception, __get_dependent_exception_from_ue,
__GXX_INIT_DEPENDENT_EXCEPTION_CLASS, __is_dependent_exception,
__gxx_dependent_exception_class, __get_object_from_ue,
__get_object_from_ambiguous_exception): Add.
(__GXX_INIT_EXCEPTION_CLASS, __gxx_exception_class): Rename.
(__is_gxx_exception_class): Handle dependent exceptions.
* libsupc++/eh_arm.cc (__cxa_type_match): Likewise.
* libsupc++/eh_call.cc (__cxa_call_unexpected): Likewise.
* libsupc++/eh_personality.cc (__gxx_personality_*): Likewise.
* libsupc++/eh_type.cc (__cxa_current_exception_type): Likewise.
* libsupc++/eh_alloc.cc (__cxa_allocate_dependent_exception,
__cxa_free_dependent_exception): Add.
* libsupc++/eh_throw.cc (__gxx_exception_cleanup): Handle reference
counting.
* libsupc++/exception: Conditionally include exception_ptr.h.
* libsupc++/Makefile.am: Register new files.
* libsupc++/Makefile.in: Regenerate.
* config/abi/pre/gnu.ver: Add new symbols.
* testsuite/18_support/exception_ptr/current_exception.cc: Test the
core functionality of current_exception().
* testsuite/18_support/exception_ptr/rethrow_exception.cc: Test the
core functionality of rethrow_exception().
* testsuite/18_support/exception_ptr/lifespan.cc: Test the life span of
exception objects during exception propagation.
From-SVN: r139509
2008-08-23 13:28:30 +02:00
|
|
|
{
|
|
|
|
char *base = (char *) dependents_buffer;
|
|
|
|
char *ptr = (char *) vptr;
|
|
|
|
if (ptr >= base
|
|
|
|
&& ptr < base + sizeof (dependents_buffer))
|
|
|
|
{
|
|
|
|
const unsigned int which
|
|
|
|
= (unsigned) (ptr - base) / sizeof (__cxa_dependent_exception);
|
|
|
|
|
|
|
|
__gnu_cxx::__scoped_lock sentry(emergency_mutex);
|
|
|
|
dependents_used &= ~((bitmask_type)1 << which);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
free (vptr);
|
|
|
|
}
|