StgClosure *volatile current_value;
StgTVarWaitQueue *volatile first_wait_queue_entry;
#if defined(SMP)
- struct StgTRecHeader_ *volatile last_update_by;
+ StgInt volatile num_updates;
#endif
} StgTVar;
StgClosure *expected_value;
StgClosure *new_value;
#if defined(SMP)
- struct StgTRecHeader_ *saw_update_by;
+ StgInt num_updates;
#endif
} TRecEntry;
-#define TREC_CHUNK_NUM_ENTRIES 256
+#define TREC_CHUNK_NUM_ENTRIES 16
typedef struct StgTRecChunk_ {
StgHeader header;
/*----------------------------------------------------------------------
- Start of day
- ------------
-
+ GC interaction
+ --------------
*/
-extern void initSTM(void);
-
extern void stmPreGCHook(void);
/*----------------------------------------------------------------------
* transaction contexts doomed to abort.
*/
-extern void stmAbortTransaction(StgTRecHeader *trec);
+extern void stmAbortTransaction(Capability *cap, StgTRecHeader *trec);
/*
* Ensure that a subsequent commit / validation will fail. We use this
* in case other threads' updates make it valid in the mean time.
*/
-extern void stmCondemnTransaction(StgTRecHeader *trec);
+extern void stmCondemnTransaction(Capability *cap, StgTRecHeader *trec);
/*
* Return the trec within which the specified trec was created (not
* Test whether the current transaction context is valid and, if so,
* start the thread waiting for updates to any of the tvars it has
* ready from and mark it as blocked. It is an error to call stmWait
- * if the thread is already waiting.
+ * if the thread is already waiting.
*/
extern StgBool stmWait(Capability *cap,
StgTSO *tso,
StgTRecHeader *trec);
+extern void stmWaitUnlock(Capability *cap, StgTRecHeader *trec);
+
/*
* Test whether the current transaction context is valid and, if so,
* leave the thread waiting and mark it as blocked again. If the
* thread is not waiting.
*/
-extern StgBool stmReWait(StgTSO *tso);
+extern StgBool stmReWait(Capability *cap, StgTSO *tso);
/*----------------------------------------------------------------------