X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=includes%2FSTM.h;h=3bf976551d71e8b950a2d3c1245453c591ff79ea;hp=4c2b109f73ab33923ced896c9a47fe1335656238;hb=842e9d6628a27cf1f420d53f6a5901935dc50c54;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1 diff --git a/includes/STM.h b/includes/STM.h index 4c2b109..3bf9765 100644 --- a/includes/STM.h +++ b/includes/STM.h @@ -66,14 +66,13 @@ extern StgTRecHeader *stmStartNestedTransaction(Capability *cap, StgTRecHeader * ); /* - * Exit the current transaction context, abandoning any read/write - * operations performed within it and removing the thread from any - * tvar wait queues if it was waitin. Note that if nested transactions - * are not fully supported then this may leave the enclosing - * transaction contexts doomed to abort. + * Roll back the current transatcion context. NB: if this is a nested tx + * then we merge its read set into its parents. This is because a change + * to that read set could change whether or not the tx should abort. */ extern void stmAbortTransaction(Capability *cap, StgTRecHeader *trec); +extern void stmFreeAbortedTRec(Capability *cap, StgTRecHeader *trec); /* * Ensure that a subsequent commit / validation will fail. We use this @@ -149,6 +148,18 @@ extern StgBool stmValidateNestOfTransactions(StgTRecHeader *trec); */ /* + * Fill in the trec's list of invariants that might be violated by the current + * transaction. + */ + +extern StgInvariantCheckQueue *stmGetInvariantsToCheck(Capability *cap, + StgTRecHeader *trec); + +extern void stmAddInvariantToCheck(Capability *cap, + StgTRecHeader *trec, + StgClosure *code); + +/* * Test whether the current transaction context is valid and, if so, * commit its memory accesses to the heap. stmCommitTransaction must * unblock any threads which are waiting on tvars that updates have @@ -218,14 +229,11 @@ extern void stmWriteTVar(Capability *cap, /* NULLs */ -#define END_STM_WAIT_QUEUE ((StgTVarWaitQueue *)(void *)&stg_END_STM_WAIT_QUEUE_closure) +#define END_STM_WATCH_QUEUE ((StgTVarWatchQueue *)(void *)&stg_END_STM_WATCH_QUEUE_closure) +#define END_INVARIANT_CHECK_QUEUE ((StgInvariantCheckQueue *)(void *)&stg_END_INVARIANT_CHECK_QUEUE_closure) #define END_STM_CHUNK_LIST ((StgTRecChunk *)(void *)&stg_END_STM_CHUNK_LIST_closure) -#if IN_STG_CODE -#define NO_TREC (stg_NO_TREC_closure) -#else #define NO_TREC ((StgTRecHeader *)(void *)&stg_NO_TREC_closure) -#endif /*----------------------------------------------------------------------*/