Support __cxa_free_exception and fix exception handling.
gcc/cp/
* except.c (do_free_exception): Use transactional wrapper.
libitm/
* testsuite/libitm.c++/eh-5.C: New.
* libitm.h (_ITM_cxa_free_exception): New.
* libitm.map (_ITM_cxa_free_exception): Add it.
* libitm.texi: Update ABI docs.
* libitm_i.h (gtm_transaction_cp::cxa_unthrown): Remove.
(gtm_transaction_cp::cxa_uncaught_count): Add.
(gtm_thread::cxa_unthrown): Remove.
(gtm_thread::cxa_uncaught_count_ptr): Add.
(gtm_thread::cxa_uncaught_count): Add.
(gtm_thread::drop_references_allocations): Rename to...
(gtm_thread::discard_allocation): ... this and adapt.
(gtm_thread::init_cpp_exceptions): New.
* beginend.cc (gtm_thread::gtm_thread): Adapt EH handling.
(gtm_thread::begin_transaction): Likewise.
(gtm_transaction_cp::save): Likewise.
(gtm_thread::trycommit): Likewise.
* eh_cpp.cc: Add overview comments.
(__cxa_eh_globals, __cxa_get_globals, __cxa_free_exception): Declare.
(free_any_exception, _ITM_cxa_free_exception): New.
(gtm_thread::init_cpp_exceptions): Define.
(_ITM_cxa_allocate_exception, _ITM_cxa_throw): Adapt.
(_ITM_cxa_begin_catch, _ITM_cxa_end_catch): Likewise.
(gtm_thread::revert_cpp_exceptions): Likewise.
From-SVN: r230634
diff --git a/libitm/libitm_i.h b/libitm/libitm_i.h
index bf8d4d1..f01a1ab 100644
--- a/libitm/libitm_i.h
+++ b/libitm/libitm_i.h
@@ -132,7 +132,7 @@
_ITM_transactionId_t id;
uint32_t prop;
uint32_t cxa_catch_count;
- void *cxa_unthrown;
+ unsigned int cxa_uncaught_count;
// We might want to use a different but compatible dispatch method for
// a nested transaction.
abi_dispatch *disp;
@@ -242,7 +242,9 @@
// Data used by eh_cpp.c for managing exceptions within the transaction.
uint32_t cxa_catch_count;
- void *cxa_unthrown;
+ // If cxa_uncaught_count_ptr is 0, we don't need to roll back exceptions.
+ unsigned int *cxa_uncaught_count_ptr;
+ unsigned int cxa_uncaught_count;
void *eh_in_flight;
// Checkpoints for closed nesting.
@@ -284,9 +286,9 @@
void record_allocation (void *, void (*)(void *));
void forget_allocation (void *, void (*)(void *));
void forget_allocation (void *, size_t, void (*)(void *, size_t));
- void drop_references_allocations (const void *ptr)
+ void discard_allocation (const void *ptr)
{
- this->alloc_actions.erase((uintptr_t) ptr);
+ alloc_actions.erase((uintptr_t) ptr);
}
// In beginend.cc
@@ -306,6 +308,7 @@
static uint32_t begin_transaction(uint32_t, const gtm_jmpbuf *)
__asm__(UPFX "GTM_begin_transaction") ITM_REGPARM;
// In eh_cpp.cc
+ void init_cpp_exceptions ();
void revert_cpp_exceptions (gtm_transaction_cp *cp = 0);
// In retry.cc