[project @ 1999-03-26 10:29:02 by simonm]
authorsimonm <unknown>
Fri, 26 Mar 1999 10:29:08 +0000 (10:29 +0000)
committersimonm <unknown>
Fri, 26 Mar 1999 10:29:08 +0000 (10:29 +0000)
More profiling fixes.

ghc/compiler/codeGen/CgUpdate.lhs
ghc/compiler/main/Constants.lhs
ghc/includes/Constants.h
ghc/rts/GC.c
ghc/rts/StgStdThunks.hc
ghc/rts/Updates.hc

index 9164a2e..1eec8f6 100644 (file)
@@ -11,7 +11,7 @@ module CgUpdate ( pushUpdateFrame, reserveSeqFrame, pushSeqFrame ) where
 import CgMonad
 import AbsCSyn
 
-import Constants       ( uF_SIZE, sCC_UF_SIZE, sEQ_FRAME_SIZE )
+import Constants       ( uF_SIZE, sCC_UF_SIZE, sEQ_FRAME_SIZE, sCC_SEQ_FRAME_SIZE )
 import PrimRep         ( PrimRep(..) )
 import CgStackery      ( allocUpdateFrame )
 import CgUsages                ( getSpRelOffset )
@@ -71,13 +71,16 @@ args_sp.  When the scrutinee comes around to pushing a return address,
 it will also push the SEQ frame, using pushSeqFrame.
 
 \begin{code}
+seq_frame_size | opt_SccProfilingOn = sCC_SEQ_FRAME_SIZE
+              | otherwise          = sEQ_FRAME_SIZE
+
 reserveSeqFrame :: EndOfBlockInfo -> EndOfBlockInfo
 reserveSeqFrame (EndOfBlockInfo args_sp (CaseAlts amode stuff)) 
-  = EndOfBlockInfo (args_sp + sEQ_FRAME_SIZE) (SeqFrame amode stuff)
+  = EndOfBlockInfo (args_sp + seq_frame_size) (SeqFrame amode stuff)
 
 pushSeqFrame :: VirtualSpOffset -> FCode VirtualSpOffset
 pushSeqFrame args_sp
   = getSpRelOffset args_sp  `thenFC` \ sp_rel ->
     absC (CMacroStmt PUSH_SEQ_FRAME [CAddr sp_rel]) `thenC`
-    returnFC (args_sp - sEQ_FRAME_SIZE)
+    returnFC (args_sp - seq_frame_size)
 \end{code}
index eca728d..5b52a37 100644 (file)
@@ -50,6 +50,7 @@ module Constants (
        uF_CCS,
 
        sEQ_FRAME_SIZE,
+       sCC_SEQ_FRAME_SIZE,
 
        mAX_Vanilla_REG,
        mAX_Float_REG,
@@ -186,8 +187,11 @@ uF_UPDATEE     = (UF_UPDATEE::Int)
 uF_CCS         = (UF_CCS::Int)
 \end{code}
 
+Seq frame sizes.
+
 \begin{code}
-sEQ_FRAME_SIZE = (SEQ_FRAME_SIZE::Int)
+sEQ_FRAME_SIZE = (NOSCC_SEQ_FRAME_SIZE::Int)
+sCC_SEQ_FRAME_SIZE = (SCC_SEQ_FRAME_SIZE::Int)
 \end{code}
 
 \begin{code}
index 2e2c37b..12b6d0d 100644 (file)
@@ -1,5 +1,5 @@
 /* ----------------------------------------------------------------------------
- * $Id: Constants.h,v 1.5 1999/02/05 16:02:21 simonm Exp $
+ * $Id: Constants.h,v 1.6 1999/03/26 10:29:02 simonm Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
 #define NOSCC_UF_SIZE  3
 #define SCC_UF_SIZE    4
 
-#if defined(PROFILING)
-#define UF_SIZE        SCC_UF_SIZE
-#else
-#define UF_SIZE NOSCC_UF_SIZE
-#endif
-
 #define UF_RET         0
 #define UF_SU          1
 #define UF_UPDATEE     2
 
 /* -----------------------------------------------------------------------------
    SEQ frame size
+
+   I don't think seq frames really need sccs --SDM
    -------------------------------------------------------------------------- */
 
-#if defined(PROFILING)
-#define SEQ_FRAME_SIZE 3
-#else
-#define SEQ_FRAME_SIZE 2
-#endif
+#define NOSCC_SEQ_FRAME_SIZE 2
+#define SCC_SEQ_FRAME_SIZE   3
 
 /* -----------------------------------------------------------------------------
    STG Registers.
index b56f995..05728ca 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: GC.c,v 1.56 1999/03/25 13:14:05 simonm Exp $
+ * $Id: GC.c,v 1.57 1999/03/26 10:29:04 simonm Exp $
  *
  * (c) The GHC Team 1998-1999
  *
@@ -2313,10 +2313,10 @@ scavenge_stack(StgPtr p, StgPtr stack_end)
    */
 
   while (p < stack_end) {
-    q = *stgCast(StgPtr*,p);
+    q = *(P_ *)p;
 
     /* If we've got a tag, skip over that many words on the stack */
-    if (IS_ARG_TAG(stgCast(StgWord,q))) {
+    if (IS_ARG_TAG((W_)q)) {
       p += ARG_SIZE(q);
       p++; continue;
     }
@@ -2342,14 +2342,14 @@ scavenge_stack(StgPtr p, StgPtr stack_end)
      * record.  All activation records have 'bitmap' style layout
      * info.
      */
-    info  = get_itbl(stgCast(StgClosure*,p));
+    info  = get_itbl((StgClosure *)p);
       
     switch (info->type) {
        
       /* Dynamic bitmap: the mask is stored on the stack */
     case RET_DYN:
       bitmap = ((StgRetDyn *)p)->liveness;
-      p      = (P_)((StgRetDyn *)p)->payload[0];
+      p      = (P_)&((StgRetDyn *)p)->payload[0];
       goto small_bitmap;
 
       /* probably a slow-entry point return address: */
index b7cac13..9af0977 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: StgStdThunks.hc,v 1.3 1999/02/05 16:03:00 simonm Exp $
+ * $Id: StgStdThunks.hc,v 1.4 1999/03/26 10:29:05 simonm Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -145,6 +145,8 @@ FN_(__ap_6_upd_entry);
 FN_(__ap_7_upd_entry);
 FN_(__ap_8_upd_entry);
 
+#define UF_SIZE (sizeofW(StgUpdateFrame))
+
 /* __ap_1_upd_info is a bit redundant, but there appears to be a bug
  * in the compiler that means __ap_1 is generated occasionally (ToDo)
  */
index e0dd5c2..f5f6928 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Updates.hc,v 1.12 1999/03/25 13:14:08 simonm Exp $
+ * $Id: Updates.hc,v 1.13 1999/03/26 10:29:06 simonm Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -227,11 +227,7 @@ EXTFUN(stg_update_PAP)
 
 #if defined(PROFILING)
     /* set "CC_pap" to go in the updatee (see Sansom thesis, p 183) */
-
-    CCS_pap = (CostCentreStack *) Fun->header.prof.ccs;
-    if (IS_CAF_OR_SUB_CCS(CCS_pap)) {
-       CCS_pap = CCCS;
-    }
+    CCS_pap = Fun->header.prof.ccs;
 #endif
 
     if (Words == 0) { 
@@ -467,7 +463,7 @@ SEQ_FRAME_ENTRY_TEMPLATE(seq_frame_5_entry,ENTRY_CODE(Sp[0]));
 SEQ_FRAME_ENTRY_TEMPLATE(seq_frame_6_entry,ENTRY_CODE(Sp[0]));
 SEQ_FRAME_ENTRY_TEMPLATE(seq_frame_7_entry,ENTRY_CODE(Sp[0]));
 
-VEC_POLY_INFO_TABLE(seq_frame,1, NULL/*srt*/, 0/*srt_off*/, 0/*srt_len*/, SEQ_FRAME);
+VEC_POLY_INFO_TABLE(seq_frame, UPD_FRAME_BITMAP, NULL/*srt*/, 0/*srt_off*/, 0/*srt_len*/, SEQ_FRAME);
 
 /* -----------------------------------------------------------------------------
  * The seq infotable
@@ -485,7 +481,7 @@ STGFUN(seq_entry)
 {
   FB_
   STK_CHK_GEN(sizeofW(StgSeqFrame), NO_PTRS, seq_entry, );
-  Sp -= sizeof(StgSeqFrame);
+  Sp -= sizeofW(StgSeqFrame);
   PUSH_SEQ_FRAME(Sp);
   R1.cl = R1.cl->payload[0];
   JMP_(ENTRY_CODE(*R1.p));