[project @ 2002-02-15 22:14:27 by sof]
[ghc-hetmet.git] / ghc / includes / StgMacros.h
index 6bd5887..711db95 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: StgMacros.h,v 1.42 2001/11/22 14:25:11 simonmar Exp $
+ * $Id: StgMacros.h,v 1.46 2002/02/15 22:14:27 sof Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -228,7 +228,7 @@ static inline int IS_ARG_TAG( StgWord p ) { return p <= ARGTAG_MAX; }
     GEN_HP_CHK_ALT(headroom,stg_gc_d1,tag_assts);
 
 #define HP_CHK_L1(headroom,tag_assts)       \
-    GEN_HP_CHK_ALT(headroom,stg_gc_d1,tag_assts);
+    GEN_HP_CHK_ALT(headroom,stg_gc_l1,tag_assts);
 
 #define HP_CHK_UT_ALT(headroom, ptrs, nptrs, r, ret, tag_assts) \
     GEN_HP_CHK_ALT(headroom, stg_gc_ut_##ptrs##_##nptrs, \
@@ -410,8 +410,8 @@ EXTINFO_RTS(stg_gen_chk_info);
         TICK_UPD_BH_UPDATABLE();                               \
         {                                                      \
          bdescr *bd = Bdescr(R1.p);                            \
-          if (bd->back != (bdescr *)BaseReg) {                 \
-             if (bd->gen->no >= 1 || bd->step->no >= 1) {      \
+          if (bd->u.back != (bdescr *)BaseReg) {               \
+             if (bd->gen_no >= 1 || bd->step->no >= 1) {       \
                 LOCK_THUNK(info);                              \
              } else {                                          \
                 EXTFUN_RTS(stg_gc_enter_1_hponly);             \
@@ -424,8 +424,8 @@ EXTINFO_RTS(stg_gen_chk_info);
         TICK_UPD_BH_SINGLE_ENTRY();                            \
         {                                                      \
          bdescr *bd = Bdescr(R1.p);                            \
-          if (bd->back != (bdescr *)BaseReg) {                 \
-             if (bd->gen->no >= 1 || bd->step->no >= 1) {      \
+          if (bd->u.back != (bdescr *)BaseReg) {               \
+             if (bd->gen_no >= 1 || bd->step->no >= 1) {       \
                 LOCK_THUNK(info);                              \
              } else {                                          \
                 EXTFUN_RTS(stg_gc_enter_1_hponly);             \
@@ -670,7 +670,7 @@ extern DLL_IMPORT_RTS const StgPolyInfoTable stg_seq_frame_info;
                StgSeqFrame *__frame;                           \
                TICK_SEQF_PUSHED();                             \
                __frame = (StgSeqFrame *)(sp);                  \
-               SET_HDR_(__frame,&stg_seq_frame_info,CCCS);     \
+               SET_HDR((StgClosure *)__frame,(StgInfoTable *)&stg_seq_frame_info,CCCS);\
                __frame->link = Su;                             \
                Su = (StgUpdateFrame *)__frame;                 \
        }
@@ -693,11 +693,20 @@ extern DLL_IMPORT_RTS const StgPolyInfoTable stg_seq_frame_info;
    Closure and Info Macros with casting.
 
    We don't want to mess around with casts in the generated C code, so
-   we use these casting versions of the closure/info tables macros.
+   we use this casting versions of the closure macro.
+
+   This version of SET_HDR also includes CCS_ALLOC for profiling - the
+   reason we don't use two separate macros is that the cost centre
+   field is sometimes a non-simple expression and we want to share its
+   value between SET_HDR and CCS_ALLOC.
    -------------------------------------------------------------------------- */
 
-#define SET_HDR_(c,info,ccs) \
-   SET_HDR((StgClosure *)(c),(StgInfoTable *)(info),ccs)
+#define SET_HDR_(c,info,ccs,size)                              \
+  {                                                            \
+      CostCentreStack *tmp = (ccs);                            \
+      SET_HDR((StgClosure *)(c),(StgInfoTable *)(info),tmp);   \
+      CCS_ALLOC(tmp,size);                                     \
+  }
 
 /* -----------------------------------------------------------------------------
    Saving context for exit from the STG world, and loading up context
@@ -801,20 +810,20 @@ LoadThreadState (void)
  * Suspending/resuming threads for doing external C-calls (_ccall_GC).
  * These functions are defined in rts/Schedule.c.
  */
-StgInt        suspendThread ( StgRegTable * );
-StgRegTable * resumeThread  ( StgInt );
+StgInt        suspendThread ( StgRegTable *, rtsBool);
+StgRegTable * resumeThread  ( StgInt, rtsBool );
 
-#define SUSPEND_THREAD(token)                  \
+#define SUSPEND_THREAD(token,threaded)         \
    SaveThreadState();                          \
-   token = suspendThread(BaseReg);
+   token = suspendThread(BaseReg,threaded);
 
 #ifdef SMP
-#define RESUME_THREAD(token)                   \
-    BaseReg = resumeThread(token);             \
+#define RESUME_THREAD(token,threaded)          \
+    BaseReg = resumeThread(token,threaded);    \
     LoadThreadState();
 #else
-#define RESUME_THREAD(token)                   \
-   (void)resumeThread(token);                  \
+#define RESUME_THREAD(token,threaded)          \
+   (void)resumeThread(token,threaded);         \
    LoadThreadState();
 #endif