@@ -184,25 +184,12 @@ GTM::gtm_transaction::rollback ()
}
void ITM_REGPARM
-_ITM_rollbackTransaction (void)
-{
- gtm_transaction *tx = gtm_tx();
-
- assert ((tx->prop & pr_hasNoAbort) == 0);
- assert ((tx->state & gtm_transaction::STATE_ABORTING) == 0);
-
- tx->rollback ();
- tx->state |= gtm_transaction::STATE_ABORTING;
-}
-
-void ITM_REGPARM
_ITM_abortTransaction (_ITM_abortReason reason)
{
gtm_transaction *tx = gtm_tx();
assert (reason == userAbort);
assert ((tx->prop & pr_hasNoAbort) == 0);
- assert ((tx->state & gtm_transaction::STATE_ABORTING) == 0);
if (tx->state & gtm_transaction::STATE_IRREVOCABLE)
abort ();
@@ -238,7 +225,7 @@ GTM::gtm_transaction::trycommit ()
bool
GTM::gtm_transaction::trycommit_and_finalize ()
{
- if ((this->state & gtm_transaction::STATE_ABORTING) || trycommit ())
+ if (trycommit ())
{
abi_disp()->fini ();
set_gtm_tx (this->prev);
@@ -252,14 +239,6 @@ GTM::gtm_transaction::trycommit_and_finalize ()
return false;
}
-bool ITM_REGPARM
-_ITM_tryCommitTransaction (void)
-{
- gtm_transaction *tx = gtm_tx();
- assert ((tx->state & gtm_transaction::STATE_ABORTING) == 0);
- return tx->trycommit ();
-}
-
void ITM_NORETURN
GTM::gtm_transaction::restart (gtm_restart_reason r)
{
@@ -45,7 +45,7 @@ extern "C" {
#define ITM_NORETURN __attribute__((noreturn))
#define ITM_PURE __attribute__((transaction_pure))
-
+
/* The following are externally visible definitions and functions, though
only very few of these should be called by user code. */
@@ -91,6 +91,7 @@ typedef enum
pr_RaRBarriersOmitted = 0x0200,
pr_undoLogCode = 0x0400,
pr_preferUninstrumented = 0x0800,
+ /* Exception blocks are not used nor supported. */
pr_exceptionBlock = 0x1000,
pr_readOnly = 0x4000,
pr_hasElse = 0x200000,
@@ -138,12 +139,8 @@ extern _ITM_transactionId_t _ITM_getTransactionId(void) ITM_REGPARM;
extern uint32_t _ITM_beginTransaction(uint32_t, ...) ITM_REGPARM;
extern void _ITM_abortTransaction(_ITM_abortReason) ITM_REGPARM ITM_NORETURN;
-extern void _ITM_rollbackTransaction (void) ITM_REGPARM;
extern void _ITM_commitTransaction (void) ITM_REGPARM;
-extern bool _ITM_tryCommitTransaction(void) ITM_REGPARM;
-
-extern void _ITM_registerThrownObject (const void *, size_t) ITM_REGPARM;
extern void _ITM_changeTransactionMode (_ITM_transactionState) ITM_REGPARM;
@@ -12,9 +12,6 @@ LIBITM_1.0 {
_ITM_getTransactionId;
_ITM_inTransaction;
_ITM_libraryVersion;
- _ITM_registerThrownObject;
- _ITM_rollbackTransaction;
- _ITM_tryCommitTransaction;
_ITM_versionCompatible;
_ITM_registerTMCloneTable;
@@ -221,25 +221,34 @@ reported for the dynamic scope as well, not just for the lexical scope
(@code{hasNoAbort}). Without this, a library cannot exploit this together
with flat nesting.
-@strong{TODO} @code{exceptionBlock?}
+@code{exceptionBlock} is not supported because exception blocks are not used.
@subsubsection [No changes] Windows exception state
@subsubsection [No changes] Other machine state
-@subsubsection Results from beginTransaction
-@strong{TODO} @code{abortTransaction} supported?
+@subsubsection [No changes] Results from beginTransaction
@subsection Aborting a transaction
-@strong{TODO} make consistent with EH.
-@subsection Committing a transaction
-@strong{TODO} make consistent with EH.
+@code{_ITM_rollbackTransaction} is not supported. @code{_ITM_abortTransaction}
+is supported but the abort reason @code{exceptionBlockAbort} is not (and there
+are no exception blocks in general, so the related cases also do not have to
+be considered).
-@subsection Exception handling support
+@subsection Committing a transaction
-@strong{TODO} Document wrappers. Document code generated for commit, perhaps
-with examples similar to those in the specification. What can be removed from
-the ABI in turn? Document requirements on libstdc++ (@code{_cxa_tm_cleanup()}).
+The exception handling (EH) scheme is different. The Intel ABI requires the
+@code{_ITM_tryCommitTransaction} function that will return even when the
+commit failed and will have to be matched with calls to either
+@code{_ITM_abortTransaction} or @code{_ITM_commitTransaction}. In contrast,
+gcc relies on transactional wrappers for the functions of the Exception
+Handling ABI and on one additional commit function (shown below). This allows
+the TM to keep track of EH internally and thus it does not have to embed the
+cleanup of EH state into the existing EH code in the program.
+@code{_ITM_tryCommitTransaction} is not supported.
+@code{_ITM_commitTransactionToId} is also not supported because the
+propagation of thrown exceptions will not bypass commits of nested
+transactions.
@example
void _ITM_commitTransactionEH(void *exc_ptr) ITM_REGPARM;
@@ -249,6 +258,42 @@ void *_ITM_cxa_begin_catch (void *exc_ptr);
void _ITM_cxa_end_catch (void);
@end example
+@code{_ITM_commitTransactionEH} must be called to commit a transaction if an
+exception could be in flight at this position in the code. @code{exc_ptr} is
+the current exception or zero if there is no current exception.
+The @code{_ITM_cxa...} functions are transactional wrappers for the respective
+@code{__cxa...} functions and must be called instead of these in transactional
+code.
+
+To support this EH scheme, libstdc++ needs to provide one additional function
+(@code{_cxa_tm_cleanup}), which is used by the TM to clean up the exception
+handling state while rolling back a transaction:
+
+@example
+void __cxa_tm_cleanup (void *unthrown_obj, void *cleanup_exc,
+ unsigned int caught_count);
+@end example
+
+@code{unthrown_obj} is non-null if the program called
+@code{__cxa_allocate_exception} for this exception but did not yet called
+@code{__cxa_throw} for it. @code{cleanup_exc} is non-null if the program is
+currently processing a cleanup along an exception path but has not caught this
+exception yet. @code{caught_count} is the nesting depth of
+@code{__cxa_begin_catch} within the transaction (which can be counted by the TM
+using @code{_ITM_cxa_begin_catch} and @code{_ITM_cxa_end_catch});
+@code{__cxa_tm_cleanup} then performs rollback by essentially performing
+@code{__cxa_end_catch} that many times.
+
+
+
+@subsection Exception handling support
+
+Currently, there is no support for functionality like
+@code{__transaction_cancel throw} as described in the C++ TM specification.
+Supporting this should be possible with the EH scheme explained previously
+because via the transactional wrappers for the EH ABI, the TM is able to
+observe and intercept EH.
+
@subsection [No changes] Transition to serial--irrevocable mode
@subsection [No changes] Data transfer functions
@@ -146,10 +146,6 @@ struct gtm_transaction
// Set if the serial-irrevocable dispatch table is installed.
// Implies that no logging is being done, and abort is not possible.
static const uint32_t STATE_IRREVOCABLE = 0x0002;
- // Set if we're in the process of aborting the transaction. This is
- // used when _ITM_rollbackTransaction is called to begin the abort
- // and ends with _ITM_commitTransaction.
- static const uint32_t STATE_ABORTING = 0x0004;
// A bitmask of the above.
uint32_t state;