On Thu, Jan 7, 2016 at 8:47 AM, Torvald Riegel <trie...@redhat.com> wrote: > The attached patch makes some exceptions transaction-safe, as require by > the Transactional Memory TS. I believe I addressed all feedback for the > previous version of this patch (in particular, there are now more safety > checks for preconditions for this implementation (eg, that the new > allocator is used), all exceptions declared by the TM TS are now > supported (with the exception of tx_exception -- should I add that in a > follow-up patch?), and there is a test for the new functionality (as > part of libitm's testsuite)). > > There are two things that complicate such support. First, it seems > better to not rely on -fgnu-tm of libstdc++ code for now (or at least we > tried to avoid this so far). Therefore, the transactional clones in > this patch are all manually instrumented (ie, the functions are C > functions with names matching the mangled names of the respective C++ > functions, and the _ZGTt prefix signaling that they are txnal clones). > > Second, exceptions still use a COW string internally, which cannot be > made transaction-safe with just compiler support because of the > reference counting implementation inside of COW strings, which uses > atomics. One would need something custom for that nonetheless. > > Thus, the patch adds txnal clones as required. They are new exported > symbols, but not visible to nontransactional code. The only changes to > headers is transaction_safe[_dynamic] annotations where required by the > TS, and a few friend declarations. The annotations are only enabled if > a user compiles with -fgnu-tm. IOW, the changes are pretty much > invisible when not using the TM TS. > > There are also commented-out calls to _ITM_setAssociatedException in the > code, which exist to show how we plan to support transaction > cancellation through exceptions (which needs some more libitm support > and bugfixes on the compiler side). > > Tested on x86_64-linux and x86-linux. > > OK? > > 2016-01-07 Torvald Riegel <trie...@redhat.com> > > * include/bits/basic_string.h (basic_string): Declare friends. > * include/bits/c++config (_GLIBCXX_TXN_SAFE, > _GLIBCXX_TXN_SAFE_DYN, _GLIBCXX_USE_ALLOCATOR_NEW): New. > * include/std/stdexcept (logic_error, domain_error, invalid_argument, > length_error, out_of_range, runtime_error, range_error, > underflow_error, overflow_error): Declare members as transaction-safe. > (logic_error, runtime_error): Declare friend functions. > * libsupc++/exception (exception, bad_exception): Declare members as > transaction-safe. > * src/c++11/cow-stdexcept.cc: Define transactional clones for the > transaction-safe members of exceptions and helper functions. > * libsupc++/eh_exception.cc: Adjust and define transactional clones. > * config/abi/pre/gnu.ver (GLIBCXX_3.4.22) Add transactional clones. > (CXXABI_1.3.10): New. > * acinclude.m4 (GLIBCXX_CHECK_SIZE_T_MANGLING): New. > (GLIBCXX_ENABLE_ALLOCATOR): Set ENABLE_ALLOCATOR_NEW. > * configure.ac: Call GLIBCXX_CHECK_SIZE_T_MANGLING. > * include/Makefile.am: Write ENABLE_ALLOCATOR_NEW to c++config.h. > * include/Makefile.in: Regenerate. > * config.h.in: Regenerate. > * configure: Regenerate. >
Don't you need to update baseline_symbols.txt? -- H.J.