X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fincludes%2FTSO.h;h=82ecacb867f065f117560e82e4922769dcecba25;hb=e6218fe7eff4e34e1a3c823cd4b7aebe09d2d4fb;hp=098ec4c93f7339460e49aab4be0c19dd5ef0c331;hpb=03dc2dd3dd814ad85cc4c45e9cafc7b73163c8be;p=ghc-hetmet.git diff --git a/ghc/includes/TSO.h b/ghc/includes/TSO.h index 098ec4c..82ecacb 100644 --- a/ghc/includes/TSO.h +++ b/ghc/includes/TSO.h @@ -77,6 +77,22 @@ typedef StgTSOStatBuf StgTSOGranInfo; */ typedef StgWord32 StgThreadID; +/* + * Flags for the tso->flags field. + * + * The TSO_DIRTY flag indicates that this TSO's stack should be + * scanned during garbage collection. The link field of a TSO is + * always scanned, so we don't have to dirty a TSO just for linking + * it on a different list. + * + * TSO_DIRTY is set by + * - schedule(), just before running a thread, + * - raiseAsync(), because it modifies a thread's stack + * - resumeThread(), just before running the thread again + * and unset by the garbage collector (only). + */ +#define TSO_DIRTY 1 + /* * Type returned after running a thread. Values of this type * include HeapOverflow, StackOverflow etc. See Constants.h for the @@ -85,7 +101,7 @@ typedef StgWord32 StgThreadID; typedef unsigned int StgThreadReturnCode; #if defined(mingw32_HOST_OS) -/* results from an async I/O request + it's ID. */ +/* results from an async I/O request + its request ID. */ typedef struct { unsigned int reqID; int len; @@ -98,7 +114,7 @@ typedef union { struct StgTSO_ *tso; StgInt fd; /* StgInt instead of int, so that it's the same size as the ptrs */ #if defined(mingw32_HOST_OS) - StgAsyncIOResult* async_result; + StgAsyncIOResult *async_result; #endif StgWord target; } StgTSOBlockInfo; @@ -117,23 +133,20 @@ typedef union { * field. */ -/* - * ToDo: make this structure sensible on a non-32-bit arch. - */ - typedef struct StgTSO_ { StgHeader header; struct StgTSO_* link; /* Links threads onto blocking queues */ struct StgTSO_* global_link; /* Links all threads together */ - StgWord16 what_next; /* Values defined in Constants.h */ - StgWord16 why_blocked; /* Values defined in Constants.h */ + StgWord16 what_next; /* Values defined in Constants.h */ + StgWord16 why_blocked; /* Values defined in Constants.h */ + StgWord32 flags; StgTSOBlockInfo block_info; struct StgTSO_* blocked_exceptions; StgThreadID id; int saved_errno; - struct StgMainThread_* main; + struct Task_* bound; // non-NULL for a bound thread struct StgTRecHeader_ *trec; /* STM transaction record */ #ifdef TICKY_TICKY @@ -240,7 +253,11 @@ extern StgTSO dummy_tso; /* this is the NIL ptr for a TSO queue (e.g. runnable queue) */ +#if IN_STG_CODE +#define END_TSO_QUEUE (stg_END_TSO_QUEUE_closure) +#else #define END_TSO_QUEUE ((StgTSO *)(void*)&stg_END_TSO_QUEUE_closure) +#endif #if defined(PAR) || defined(GRAN) /* this is the NIL ptr for a blocking queue */