/* ----------------------------------------------------------------------------
- * $Id: Closures.h,v 1.12 1999/03/25 13:01:44 simonm Exp $
+ * $Id: Closures.h,v 1.16 2000/01/18 12:36:38 simonmar Exp $
*
* (c) The GHC Team, 1998-1999
*
The parallel header
-------------------------------------------------------------------------- */
-#ifdef GRAN
+#ifdef PAR
typedef struct {
- W_ procs;
-} StgGranHeader;
+ /* StgWord ga; */ /* nope! global addresses are managed via a hash table */
+} StgParHeader;
#else /* !PAR */
typedef struct {
/* empty */
-} StgGranHeader;
+} StgParHeader;
#endif /* PAR */
/* -----------------------------------------------------------------------------
+ The GranSim header
+ -------------------------------------------------------------------------- */
+
+#if defined(GRAN)
+
+typedef struct {
+ StgWord procs; /* bitmask indicating on which PEs this closure resides */
+} StgGranHeader;
+
+#else /* !GRAN */
+
+typedef struct {
+ /* empty */
+} StgGranHeader;
+
+#endif /* GRAN */
+
+/* -----------------------------------------------------------------------------
The ticky-ticky header
Comment from old Ticky.h:
info tables to be @_Evacuate_1@ and @_Scavenge_1_0@.
-------------------------------------------------------------------------- */
-#ifdef TICKY
+#ifdef TICKY_TICKY
typedef struct {
- W_ updated;
+ /* old: W_ updated; */
} StgTickyHeader;
-#else /* !TICKY */
+#else /* !TICKY_TICKY */
typedef struct {
/* empty */
} StgTickyHeader;
-#endif /* TICKY */
+#endif /* TICKY_TICKY */
/* -----------------------------------------------------------------------------
The full fixed-size closure header
#ifdef PROFILING
StgProfHeader prof;
#endif
+#ifdef PAR
+ StgParHeader par;
+#endif
#ifdef GRAN
- StgGranHeader par;
+ StgGranHeader gran;
#endif
-#ifdef TICKY
+#ifdef TICKY_TICKY
StgTickyHeader ticky;
#endif
} StgHeader;
typedef struct {
StgHeader header;
- struct StgTSO_ *blocking_queue;
- StgMutClosure *mut_link;
-} StgBlockingQueue;
-
-typedef struct {
- StgHeader header;
StgWord words;
StgWord payload[0];
} StgArrWords;
typedef struct {
StgHeader header;
struct _StgUpdateFrame *link;
+ StgInt exceptions_blocked;
StgClosure *handler;
} StgCatchFrame;
StgHeader header;
StgWord sn;
} StgStableName;
-
+
typedef struct _StgWeak { /* Weak v */
StgHeader header;
StgClosure *key;
StgClosure* value;
} StgMVar;
-/* Parallel FETCH_ME closures */
-#ifdef PAR
-typedef struct {
+#if defined(PAR) || defined(GRAN)
+/*
+ StgBlockingQueueElement represents the types of closures that can be
+ found on a blocking queue: StgTSO, StgRBHSave, StgBlockedFetch.
+ (StgRBHSave can only appear at the end of a blocking queue).
+ Logically, this is a union type, but defining another struct with a common
+ layout is easier to handle in the code (same as for StgMutClosures).
+*/
+typedef struct StgBlockingQueueElement_ {
+ StgHeader header;
+ struct StgBlockingQueueElement_ *link;
+ StgMutClosure *mut_link;
+ struct StgClosure_ *payload[0];
+} StgBlockingQueueElement;
+
+typedef struct StgBlockingQueue_ {
+ StgHeader header;
+ struct StgBlockingQueueElement_ *blocking_queue;
+ StgMutClosure *mut_link;
+} StgBlockingQueue;
+
+/* this closure is hanging at the end of a blocking queue in (par setup only) */
+typedef struct StgRBHSave_ {
StgHeader header;
- void *ga; /* type globalAddr is abstract here */
+ StgPtr payload[0];
+} StgRBHSave;
+
+typedef struct StgRBH_ {
+ StgHeader header;
+ struct StgBlockingQueueElement_ *blocking_queue;
+ StgMutClosure *mut_link;
+} StgRBH;
+
+#else
+
+typedef struct StgBlockingQueue_ {
+ StgHeader header;
+ struct StgTSO_ *blocking_queue;
+ StgMutClosure *mut_link;
+} StgBlockingQueue;
+
+#endif
+
+#if defined(PAR)
+/* global indirections aka FETCH_ME closures */
+typedef struct StgFetchMe_ {
+ StgHeader header;
+ globalAddr *ga; /* type globalAddr is abstract here */
+ StgMutClosure *mut_link;
} StgFetchMe;
+
+/* same contents as an ordinary StgBlockingQueue */
+typedef struct StgFetchMeBlockingQueue_ {
+ StgHeader header;
+ struct StgBlockingQueueElement_ *blocking_queue;
+ StgMutClosure *mut_link;
+} StgFetchMeBlockingQueue;
+
+/* entry in a blocking queue, indicating a request from a TSO on another PE */
+typedef struct StgBlockedFetch_ {
+ StgHeader header;
+ struct StgBlockingQueueElement_ *link;
+ StgMutClosure *mut_link;
+ StgClosure *node;
+ globalAddr ga;
+} StgBlockedFetch;
#endif
#endif /* CLOSURES_H */