aboutsummaryrefslogtreecommitdiff
path: root/libitm/beginend.cc
diff options
context:
space:
mode:
authorTorvald Riegel <triegel@redhat.com>2015-11-20 00:10:08 +0000
committerTorvald Riegel <torvald@gcc.gnu.org>2015-11-20 00:10:08 +0000
commit258c1d072225bac0a5063ce486907c9b6eb357e2 (patch)
treea5f0213fc60fbb82a4c54b886984d2979e44646d /libitm/beginend.cc
parent9afebea2d5e12b574d70497a87f0d2fd1b1d7f90 (diff)
downloadgcc-258c1d072225bac0a5063ce486907c9b6eb357e2.zip
gcc-258c1d072225bac0a5063ce486907c9b6eb357e2.tar.gz
gcc-258c1d072225bac0a5063ce486907c9b6eb357e2.tar.bz2
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
Diffstat (limited to 'libitm/beginend.cc')
-rw-r--r--libitm/beginend.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/libitm/beginend.cc b/libitm/beginend.cc
index c3ed11b..86f7b39 100644
--- a/libitm/beginend.cc
+++ b/libitm/beginend.cc
@@ -132,6 +132,8 @@ GTM::gtm_thread::gtm_thread ()
number_of_threads_changed(number_of_threads - 1, number_of_threads);
serial_lock.write_unlock ();
+ init_cpp_exceptions ();
+
if (pthread_once(&thr_release_once, thread_exit_init))
GTM_fatal("Initializing thread release TLS key failed.");
// Any non-null value is sufficient to trigger destruction of this
@@ -383,6 +385,11 @@ GTM::gtm_thread::begin_transaction (uint32_t prop, const gtm_jmpbuf *jb)
#endif
}
+ // Log the number of uncaught exceptions if we might have to roll back this
+ // state.
+ if (tx->cxa_uncaught_count_ptr != 0)
+ tx->cxa_uncaught_count = *tx->cxa_uncaught_count_ptr;
+
// Run dispatch-specific restart code. Retry until we succeed.
GTM::gtm_restart_reason rr;
while ((rr = disp->begin_or_restart()) != NO_RESTART)
@@ -411,7 +418,7 @@ GTM::gtm_transaction_cp::save(gtm_thread* tx)
id = tx->id;
prop = tx->prop;
cxa_catch_count = tx->cxa_catch_count;
- cxa_unthrown = tx->cxa_unthrown;
+ cxa_uncaught_count = tx->cxa_uncaught_count;
disp = abi_disp();
nesting = tx->nesting;
}
@@ -583,7 +590,6 @@ GTM::gtm_thread::trycommit ()
undolog.commit ();
// Reset further transaction state.
cxa_catch_count = 0;
- cxa_unthrown = NULL;
restart_total = 0;
// Ensure privatization safety, if necessary.