usermode/library/mtm/src/itm.h

00001 
00011 /*
00012  * This file can be processed with doxygen to generate documentation.
00013  * If you do that you will get better results if you use this set of parameters
00014  * in your Doxyfile.
00015  *
00016  *  ENABLE_PREPROCESSING   = YES
00017  *  MACRO_EXPANSION        = YES
00018  *  EXPAND_ONLY_PREDEF     = YES
00019  *  PREDEFINED             = "_ITM_NORETURN(arg) = arg "\
00020  *                           "_ITM_CALL_CONVENTION= "   \
00021  *                           "_ITM_PRIVATE= "           \
00022  *                           "_ITM_EXPORT= "            \
00023  *  EXPAND_AS_DEFINED      = _ITM_FOREACH_TRANSFER
00024  */
00025 
00034 #if !defined(_ITM09_H)                            /* Idempotence */
00035 # define _ITM09_H
00037 # define _ITM_VERSION "0.9 (October 1, 2008)"
00038 /* We undef _ITM_VERSION_NO before defining it since it may have been set by the build system
00039  * to a less precise version than we know here. (e.g. 70 when we're 72).
00040  */
00041 # undef _ITM_VERSION_NO
00043 # define _ITM_VERSION_NO 90
00044 
00045 # ifdef __cplusplus
00046 extern "C"
00047 {
00048 # endif                          /* __cplusplus */
00049 
00050 # include <xmmintrin.h>
00051 # include <stddef.h>
00052 
00053     /* defined(_WIN32) should be sufficient, but it looks so much like a latent bug
00054      * that I also test _WIN64
00055      */
00056 # if (defined (_WIN32) || defined (_WIN64))
00057 #  define  _ITM_NORETURN(funcspec) __declspec(noreturn) funcspec
00058 /* May need something here for Windows, but I'm not fixing that just now... */
00059 #  define  _ITM_EXPORT
00060 #  define  _ITM_PRIVATE
00061 # else
00062 #  define _ITM_NORETURN(funcspec) funcspec __attribute__((noreturn))
00063 #  define _ITM_EXPORT  __attribute__((visibility("default")))
00064 #  define _ITM_PRIVATE __attribute__((visibility("hidden" )))
00065 # endif
00066 
00067 # include "itmuser.h"
00068 
00069 /* Opaque types passed over the interface.
00070  * In most cases these allow us to use pointers to specific opaque
00071  * types, rather than just "void *" and thus get some type checking
00072  * without having to make the content of the type visible.  This also
00073  * allows the data-flow from the result of one function to an argument
00074  * to another to be clearer.
00075  */
00077 struct _ITM_mementoS;
00078 typedef struct _ITM_mementoS _ITM_memento;
00079 
00081 struct _ITM_srcLocationS
00082 {
00083     int32 reserved_1;
00084     int32 flags;
00085     int32 reserved_2;
00086     int32 reserved_3;
00087     const char *psource; 
00094 };
00095 
00096 typedef struct _ITM_srcLocationS _ITM_srcLocation;
00097 
00101 typedef enum 
00102 {
00103    pr_instrumentedCode   = 0x0001, 
00104    pr_uninstrumentedCode = 0x0002, 
00105    pr_multiwayCode = pr_instrumentedCode | pr_uninstrumentedCode,
00106    pr_hasNoXMMUpdate     = 0x0004, 
00107    pr_hasNoAbort         = 0x0008, 
00108    pr_hasNoRetry         = 0x0010, 
00109    pr_hasNoIrrevocable   = 0x0020, 
00110    pr_doesGoIrrevocable  = 0x0040, 
00111    pr_hasNoSimpleReads   = 0x0080, 
00113    /* More detailed information about properties of instrumented code generation. 
00114     * These don't tell us that the transaction had no need for these barriers (like hasNoSimpleReads),
00115     * rather that the compiler simply generated native ld/st for these operations and omitted the
00116     * barriers. (Useful if the library implementation didn't need them, for instance an in-place
00117     * update STM never needs to know about "after Write" operations).
00118     */
00119    pr_aWBarriersOmitted  = 0x0100, 
00120    pr_RaRBarriersOmitted = 0x0200, 
00121    pr_undoLogCode        = 0x0400, 
00123    /* Another hint from the compiler. */
00124    pr_preferUninstrumented
00125                          = 0x0800, 
00126    pr_exceptionBlock     = 0x1000,
00127    pr_hasElse            = 0x2000
00128 } _ITM_codeProperties;
00129 
00131 typedef enum
00132 {
00133     a_runInstrumentedCode   = 0x01, 
00134     a_runUninstrumentedCode = 0x02, 
00135     a_saveLiveVariables     = 0x04, 
00136     a_restoreLiveVariables  = 0x08, 
00137     a_abortTransaction      = 0x10, 
00138 } _ITM_actions;
00139 
00141 typedef enum 
00142 {
00143     modeSerialIrrevocable, 
00144     modeObstinate,         
00145     modeOptimistic,        
00146     modePessimistic,       
00147 } _ITM_transactionState;
00148 
00150 typedef enum {
00151     unknown = 0,
00152     userAbort = 1,     
00153     userRetry = 2,     
00154     TMConflict= 4,     
00155     exceptionBlockAbort = 8   
00156 } _ITM_abortReason;
00157 
00158 
00160 _ITM_EXPORT extern void * _ITM_CALL_CONVENTION _ITM_malloc (size_t size);
00161 
00162 _ITM_EXPORT extern void _ITM_CALL_CONVENTION _ITM_free (void * ptr);
00163 
00165 _ITM_EXPORT extern const char * _ITM_CALL_CONVENTION _ITM_libraryVersion (void);
00166 
00170 _ITM_EXPORT extern int _ITM_CALL_CONVENTION _ITM_versionCompatible (int); /* Zero if not compatible */
00171 
00179 _ITM_EXPORT extern int  _ITM_CALL_CONVENTION _ITM_initializeProcess(void);      /* Idempotent */
00180 _ITM_EXPORT extern void _ITM_CALL_CONVENTION _ITM_finalizeProcess(void);
00181 _ITM_EXPORT extern int  _ITM_CALL_CONVENTION _ITM_initializeThread(void);       /* Idempotent */
00182 _ITM_EXPORT extern void _ITM_CALL_CONVENTION _ITM_finalizeThread(void);
00183 
00185 _ITM_NORETURN (_ITM_EXPORT extern void _ITM_CALL_CONVENTION _ITM_error (const _ITM_srcLocation *, int errorCode));
00186 
00187 /* _ITM_getTransaction(void), _ITM_inTransaction(_ITM_transaction*), and
00188    _ITM_getTransactionId(_ITM_transaction*) are in itmuser.h */
00189 
00197 _ITM_EXPORT extern uint32 _ITM_CALL_CONVENTION _ITM_beginTransaction  (_ITM_transaction *td,
00198                                                                          uint32 __properties,
00199                                                                          const _ITM_srcLocation *__src);
00200 
00209 _ITM_EXPORT extern void _ITM_CALL_CONVENTION _ITM_commitTransaction     (_ITM_transaction *td,
00210                                                                          const _ITM_srcLocation *__src);
00211 
00217 _ITM_EXPORT extern uint32 _ITM_CALL_CONVENTION _ITM_tryCommitTransaction  (_ITM_transaction *td,
00218                                                                              const _ITM_srcLocation *__src);
00219 
00225 _ITM_EXPORT extern void _ITM_CALL_CONVENTION _ITM_commitTransactionToId (_ITM_transaction *td,
00226                                                                          const _ITM_transactionId tid,
00227                                                                          const _ITM_srcLocation *__src);
00228 
00237 _ITM_NORETURN (_ITM_EXPORT extern void _ITM_CALL_CONVENTION _ITM_abortTransaction(_ITM_transaction *td,
00238                                                                                   _ITM_abortReason __reason, 
00239                                                                                   const _ITM_srcLocation *__src));
00240 
00248 /* Will return if called with uplevelAbort, otherwise it longjumps */
00249 _ITM_EXPORT extern void _ITM_CALL_CONVENTION _ITM_rollbackTransaction(_ITM_transaction *td,
00250                                                                       const _ITM_srcLocation *__src);
00251 
00258 _ITM_EXPORT extern void _ITM_CALL_CONVENTION _ITM_registerThrownObject(_ITM_transaction *td, const void *__obj, size_t __size);
00259 
00269 _ITM_EXPORT extern void _ITM_CALL_CONVENTION _ITM_changeTransactionMode (_ITM_transaction *td,
00270                                                                          _ITM_transactionState __mode,
00271                                                                          const _ITM_srcLocation * __loc);
00272 
00273 /* Support macros to generate the multiple data transfer functions we need. 
00274  * We leave them defined because they are useful elsewhere, for instance when building
00275  * the vtables we use for mode changes.
00276  */
00277 
00278 # ifndef __cplusplus
00279 
00288 #  define _ITM_GENERATE_FOREACH_SIMPLE_TRANSFER(GENERATE, ACTION, ...)  \
00289 GENERATE (ACTION, uint8,U1, __VA_ARGS__)                              \
00290 GENERATE (ACTION, uint16,U2, __VA_ARGS__)                             \
00291 GENERATE (ACTION, uint32,U4, __VA_ARGS__)                             \
00292 GENERATE (ACTION, uint64,U8, __VA_ARGS__)                             \
00293 GENERATE (ACTION, float,F, __VA_ARGS__)                                 \
00294 GENERATE (ACTION, double,D, __VA_ARGS__)                                \
00295 GENERATE (ACTION, long double,E, __VA_ARGS__)                           \
00296 GENERATE (ACTION, __m64,M64, __VA_ARGS__)                               \
00297 GENERATE (ACTION, __m128,M128, __VA_ARGS__)                             \
00298 GENERATE (ACTION, float _Complex, CF, __VA_ARGS__)                      \
00299 GENERATE (ACTION, double _Complex, CD, __VA_ARGS__)                     \
00300 GENERATE (ACTION, long double _Complex, CE, __VA_ARGS__) 
00301 # else
00302 #  define _ITM_GENERATE_FOREACH_SIMPLE_TRANSFER(GENERATE, ACTION, ...)  \
00303 GENERATE (ACTION, uint8,U1, __VA_ARGS__)                              \
00304 GENERATE (ACTION, uint16,U2, __VA_ARGS__)                             \
00305 GENERATE (ACTION, uint32,U4, __VA_ARGS__)                             \
00306 GENERATE (ACTION, uint64,U8, __VA_ARGS__)                             \
00307 GENERATE (ACTION, float,F, __VA_ARGS__)                                 \
00308 GENERATE (ACTION, double,D, __VA_ARGS__)                                \
00309 GENERATE (ACTION, long double,E, __VA_ARGS__)                           \
00310 GENERATE (ACTION, __m64,M64, __VA_ARGS__)                               \
00311 GENERATE (ACTION, __m128,M128, __VA_ARGS__)
00312 # endif
00313 
00314 # define _ITM_FOREACH_MEMCPY0(ACTION, NAME, ...)                                                            \
00315 ACTION (void, NAME##RnWt, (_ITM_transaction *, void *, const void *, size_t), __VA_ARGS__)           \
00316 ACTION (void, NAME##RnWtaR, (_ITM_transaction *, void *, const void *, size_t), __VA_ARGS__)         \
00317 ACTION (void, NAME##RnWtaW, (_ITM_transaction *, void *, const void *, size_t), __VA_ARGS__)         \
00318 ACTION (void, NAME##RtWn,   (_ITM_transaction *, void *, const void *, size_t), __VA_ARGS__)         \
00319 ACTION (void, NAME##RtWt,   (_ITM_transaction *, void *, const void *, size_t), __VA_ARGS__)         \
00320 ACTION (void, NAME##RtWtaR, (_ITM_transaction *, void *, const void *, size_t), __VA_ARGS__)         \
00321 ACTION (void, NAME##RtWtaW, (_ITM_transaction *, void *, const void *, size_t), __VA_ARGS__)         \
00322 ACTION (void, NAME##RtaRWn, (_ITM_transaction *, void *, const void *, size_t), __VA_ARGS__)         \
00323 ACTION (void, NAME##RtaRWt, (_ITM_transaction *, void *, const void *, size_t), __VA_ARGS__)         \
00324 ACTION (void, NAME##RtaRWtaR, (_ITM_transaction *, void *, const void *, size_t), __VA_ARGS__)       \
00325 ACTION (void, NAME##RtaRWtaW, (_ITM_transaction *, void *, const void *, size_t), __VA_ARGS__)       \
00326 ACTION (void, NAME##RtaWWn, (_ITM_transaction *, void *, const void *, size_t), __VA_ARGS__)         \
00327 ACTION (void, NAME##RtaWWt, (_ITM_transaction *, void *, const void *, size_t), __VA_ARGS__)         \
00328 ACTION (void, NAME##RtaWWtaR, (_ITM_transaction *, void *, const void *, size_t), __VA_ARGS__)       \
00329 ACTION (void, NAME##RtaWWtaW, (_ITM_transaction *, void *, const void *, size_t), __VA_ARGS__)
00330 
00331 #define _ITM_FOREACH_MEMCPY(ACTION,...) _ITM_FOREACH_MEMCPY0(ACTION,memcpy,__VA_ARGS__)
00332 
00333 #define _ITM_FOREACH_MEMMOVE(ACTION,...) _ITM_FOREACH_MEMCPY0(ACTION,memmove,__VA_ARGS__)
00334 
00335 # define _ITM_FOREACH_MEMSET(ACTION, ...)                                               \
00336 ACTION (void, memsetW, (_ITM_transaction *, void *, int, size_t), __VA_ARGS__)          \
00337 ACTION (void, memsetWaR, (_ITM_transaction *, void *, int, size_t), __VA_ARGS__)        \
00338 ACTION (void, memsetWaW, (_ITM_transaction *, void *, int, size_t), __VA_ARGS__)
00339 
00340 #define _ITM_FOREACH_SIMPLE_TRANSFER(ACTION,ARG)           \
00341     _ITM_FOREACH_SIMPLE_READ_TRANSFER(ACTION,ARG)          \
00342     _ITM_FOREACH_SIMPLE_WRITE_TRANSFER(ACTION,ARG)
00343 
00344 # define _ITM_FOREACH_TRANSFER(ACTION, ARG)     \
00345  _ITM_FOREACH_SIMPLE_TRANSFER(ACTION, ARG)      \
00346  _ITM_FOREACH_MEMCPY (ACTION, ARG)              \
00347  _ITM_FOREACH_LOG_TRANSFER(ACTION,ARG)          \
00348  _ITM_FOREACH_MEMSET (ACTION,ARG)               \
00349  _ITM_FOREACH_MEMMOVE (ACTION,ARG)
00350 
00351 #  define _ITM_FOREACH_SIMPLE_READ_TRANSFER(ACTION,ARG)                           \
00352     _ITM_GENERATE_FOREACH_SIMPLE_TRANSFER(_ITM_GENERATE_READ_FUNCTIONS, ACTION,ARG) 
00353 
00354 #  define _ITM_FOREACH_SIMPLE_WRITE_TRANSFER(ACTION,ARG)                           \
00355     _ITM_GENERATE_FOREACH_SIMPLE_TRANSFER(_ITM_GENERATE_WRITE_FUNCTIONS, ACTION,ARG) 
00356 
00357 #  define _ITM_FOREACH_SIMPLE_LOG_TRANSFER(ACTION,ARG)                           \
00358     _ITM_GENERATE_FOREACH_SIMPLE_TRANSFER(_ITM_GENERATE_LOG_FUNCTIONS, ACTION,ARG) 
00359 
00360 #  define _ITM_FOREACH_LOG_TRANSFER(ACTION,ARG)                         \
00361     _ITM_FOREACH_SIMPLE_LOG_TRANSFER(ACTION,ARG)                        \
00362     ACTION(void, LB, (_ITM_transaction *, const void*, size_t), ARG)
00363 
00364 #  define _ITM_GENERATE_READ_FUNCTIONS(ACTION, result_type, encoding, ARG ) \
00365     ACTION (result_type, R##encoding,   (_ITM_transaction *, const result_type *), ARG) \
00366     ACTION (result_type, RaR##encoding, (_ITM_transaction *, const result_type *), ARG) \
00367     ACTION (result_type, RaW##encoding, (_ITM_transaction *, const result_type *), ARG) \
00368     ACTION (result_type, RfW##encoding, (_ITM_transaction *, const result_type *), ARG)         
00369 
00370 #  define _ITM_GENERATE_WRITE_FUNCTIONS(ACTION, result_type, encoding, ARG ) \
00371     ACTION (void, W##encoding,  (_ITM_transaction *, result_type *, result_type), ARG) \
00372     ACTION (void, WaR##encoding,(_ITM_transaction *, result_type *, result_type), ARG) \
00373     ACTION (void, WaW##encoding,(_ITM_transaction *, result_type *, result_type), ARG)
00374 
00375 #  define _ITM_GENERATE_LOG_FUNCTIONS(ACTION, result_type, encoding, ARG ) \
00376     ACTION (void, L##encoding,   (_ITM_transaction *, const result_type *), ARG) 
00377 
00378 # define GENERATE_PROTOTYPE(result, function, args, ARG)    \
00379     _ITM_EXPORT extern result _ITM_CALL_CONVENTION _ITM_##function args;
00380 
00381 _ITM_FOREACH_TRANSFER (GENERATE_PROTOTYPE,dummy)
00382 # undef GENERATE_PROTOTYPE
00383 
00384 # ifdef __cplusplus
00385 } /* extern "C" */
00386 # endif                          /* __cplusplus */
00387 
00388 #endif /* defined(_ITM09_H) */

Generated on Sat Apr 23 11:43:36 2011 for Mnemosyne by  doxygen 1.4.7