00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "pwb_i.h"
00034 #include "mode/pwb-common/beginend-bits.h"
00035
00036
00037 uint32_t
00038 mtm_pwbetl_beginTransaction_internal (mtm_tx_t *tx,
00039 uint32_t prop,
00040 _ITM_srcLocation *srcloc)
00041 {
00042 return beginTransaction_internal (tx, prop, srcloc, 1);
00043 }
00044
00045
00046 void _ITM_CALL_CONVENTION
00047 mtm_pwbetl_rollbackTransaction (mtm_tx_t *tx, const _ITM_srcLocation *loc)
00048 {
00049 assert ((tx->prop & pr_hasNoAbort) == 0);
00050
00051
00052 rollback_transaction (tx);
00053
00054 }
00055
00056
00057 void _ITM_CALL_CONVENTION
00058 mtm_pwbetl_abortTransaction (mtm_tx_t *tx,
00059 _ITM_abortReason reason,
00060 const _ITM_srcLocation *loc)
00061 {
00062 assert (reason == userAbort || reason == userRetry);
00063
00064 assert ((reason == userAbort && (tx->prop & pr_hasNoAbort) == 0) ||
00065 (reason == userRetry && 1));
00066
00067
00068 if (tx->status & TX_IRREVOCABLE) {
00069 abort ();
00070 }
00071
00072 if (reason == userAbort) {
00073 rollback_transaction (tx);
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 mtm_longjmp (&tx->jb, a_abortTransaction | a_restoreLiveVariables);
00090 } else if (reason == userRetry) {
00091 mtm_pwb_restart_transaction(tx, RESTART_USER_RETRY);
00092 }
00093 }
00094
00095
00096 bool _ITM_CALL_CONVENTION
00097 mtm_pwbetl_tryCommitTransaction (mtm_tx_t *tx, const _ITM_srcLocation *loc)
00098 {
00099 return trycommit_transaction(tx, 1);
00100 }
00101
00102
00103 void _ITM_CALL_CONVENTION
00104 mtm_pwbetl_commitTransaction(mtm_tx_t *tx, const _ITM_srcLocation *loc)
00105 {
00106 MTM_DEBUG_PRINT("==> mtm_pwb_commitTransaction(%p)\n", tx);
00107 if (!trycommit_transaction(tx, 1)) {
00108 mtm_pwb_restart_transaction(tx, RESTART_VALIDATE_COMMIT);
00109 }
00110 if (tx->status == TX_COMMITTED) {
00111 tx->status = TX_IDLE;
00112
00113
00114
00115 }
00116
00117 MTM_DEBUG_PRINT("==> mtm_pwb_commitTransaction(%p): DONE\n", tx);
00118 }
00119
00120
00121 void _ITM_CALL_CONVENTION
00122 mtm_pwbetl_commitTransactionToId(mtm_tx_t *tx,
00123 const _ITM_transactionId tid,
00124 const _ITM_srcLocation *loc)
00125 {
00126
00127 assert(0);
00128 }
00129
00130
00131