[project @ 2003-07-17 08:59:03 by simonmar]
[ghc-hetmet.git] / ghc / includes / Updates.h
index add8b26..952f4d1 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Updates.h,v 1.28 2002/12/11 15:36:40 simonmar Exp $
+ * $Id: Updates.h,v 1.31 2003/04/08 15:32:38 sof Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
  */
 
 #ifdef TICKY_TICKY
-# define UPD_IND(updclosure, heapptr) UPD_PERM_IND(updclosure,heapptr)
+# define UPD_IND(updclosure, heapptr) \
+   UPD_PERM_IND(updclosure,heapptr)
+# define UPD_SPEC_IND(updclosure, ind_info, heapptr, and_then) \
+   UPD_PERM_IND(updclosure,heapptr); and_then
 #else
-# define UPD_IND(updclosure, heapptr) UPD_REAL_IND(updclosure,heapptr)
+# define UPD_IND(updclosure, heapptr) \
+   UPD_REAL_IND(updclosure,&stg_IND_info,heapptr,)
+# define UPD_SPEC_IND(updclosure, ind_info, heapptr, and_then) \
+   UPD_REAL_IND(updclosure,ind_info,heapptr,and_then)
 #endif
 
 /* UPD_IND actually does a PERM_IND if TICKY_TICKY is on;
    if you *really* need an IND use UPD_REAL_IND
  */
 #ifdef SMP
-#define UPD_REAL_IND(updclosure, heapptr)                              \
+#define UPD_REAL_IND(updclosure, ind_info, heapptr, and_then)          \
    {                                                                   \
        const StgInfoTable *info;                                       \
        if (Bdescr((P_)updclosure)->u.back != (bdescr *)BaseReg) {      \
                info = updclosure->header.info;                         \
        }                                                               \
         AWAKEN_BQ(info,updclosure);                                    \
-       updateWithIndirection(info,                                     \
+       updateWithIndirection(info, ind_info,                           \
                              (StgClosure *)updclosure,                 \
-                             (StgClosure *)heapptr);                   \
+                             (StgClosure *)heapptr,                    \
+                             and_then);                                \
    }
 #else
-#define UPD_REAL_IND(updclosure, heapptr)              \
+#define UPD_REAL_IND(updclosure, ind_info, heapptr, and_then)  \
    {                                                   \
        const StgInfoTable *info;                       \
        info = ((StgClosure *)updclosure)->header.info; \
         AWAKEN_BQ(info,updclosure);                    \
-       updateWithIndirection(info,                     \
+       updateWithIndirection(((StgClosure *)updclosure)->header.info, ind_info,                \
                              (StgClosure *)updclosure, \
-                             (StgClosure *)heapptr);   \
+                             (StgClosure *)heapptr,    \
+                             and_then);                \
    }
 #endif
 
        const StgInfoTable *info;                                       \
        info = updclosure->header.info;                                 \
         AWAKEN_BQ(info,updclosure);                                    \
-       updateWithIndirection(info,                                     \
+       updateWithIndirection(info,&stg_IND_info,                       \
                              (StgClosure *)updclosure,                 \
-                             (StgClosure *)heapptr);                   \
+                             (StgClosure *)heapptr,);                  \
    }
+#elif defined(RTS_SUPPORTS_THREADS)
+
+# ifdef TICKY_TICKY
+#  define UPD_IND_NOLOCK(updclosure, heapptr)                  \
+   {                                                           \
+       const StgInfoTable *info;                               \
+       info = ((StgClosure *)updclosure)->header.info;         \
+        AWAKEN_BQ_NOLOCK(info,updclosure);                     \
+       updateWithPermIndirection(info,                         \
+                                 (StgClosure *)updclosure,     \
+                                 (StgClosure *)heapptr);       \
+   }
+# else
+#  define UPD_IND_NOLOCK(updclosure, heapptr)          \
+   {                                                   \
+       const StgInfoTable *info;                       \
+       info = ((StgClosure *)updclosure)->header.info; \
+        AWAKEN_BQ_NOLOCK(info,updclosure);             \
+       updateWithIndirection(info,&stg_IND_info,       \
+                             (StgClosure *)updclosure, \
+                             (StgClosure *)heapptr,);  \
+   }
+# endif
+
 #else
 #define UPD_IND_NOLOCK(updclosure,heapptr) UPD_IND(updclosure,heapptr)
 #endif
@@ -171,6 +203,17 @@ extern void awakenBlockedQueue(StgTSO *q);
           DO_AWAKEN_BQ(closure);                                        \
        }
 
+#ifdef RTS_SUPPORTS_THREADS
+extern void awakenBlockedQueueNoLock(StgTSO *q);
+#define DO_AWAKEN_BQ_NOLOCK(closure)                                   \
+        STGCALL1(awakenBlockedQueueNoLock,                             \
+                ((StgBlockingQueue *)closure)->blocking_queue);
+
+#define AWAKEN_BQ_NOLOCK(info,closure)                                 \
+       if (info == &stg_BLACKHOLE_BQ_info) {                           \
+          DO_AWAKEN_BQ_NOLOCK(closure);                                 \
+       }
+#endif
 #endif /* GRAN || PAR */
 
 /* -------------------------------------------------------------------------