[project @ 1999-09-14 12:16:36 by simonmar]
authorsimonmar <unknown>
Tue, 14 Sep 1999 12:16:39 +0000 (12:16 +0000)
committersimonmar <unknown>
Tue, 14 Sep 1999 12:16:39 +0000 (12:16 +0000)
A couple of fixes and cleanups to ticky-ticky profiling:

- remove UPD_EXISTING (doesn't make sense)
- add UPD_CON_IN_PLACE, now that we have in-place updates
- clean up the output a little.

ghc/compiler/codeGen/CgCon.lhs
ghc/includes/StgTicky.h
ghc/rts/Ticky.c
ghc/rts/Updates.hc

index 5ab41b1..5fa258b 100644 (file)
@@ -328,6 +328,10 @@ cgReturnDataCon con amodes all_zero_size_args
                uniq = getUnique con
                temp = CTemp uniq PtrRep 
           in
+
+          profCtrC SLIT("TICK_UPD_CON_IN_PLACE") 
+                       [mkIntCLit (length amodes)] `thenC`
+
           getSpRelOffset args_sp                       `thenFC` \ sp_rel ->
           absC (CAssign temp 
                    (CMacroExpr PtrRep UPD_FRAME_UPDATEE [CAddr sp_rel])) 
index dc0a478..cf68671 100644 (file)
@@ -1,5 +1,5 @@
 /* ----------------------------------------------------------------------------
- * $Id: StgTicky.h,v 1.5 1999/06/24 13:10:31 simonmar Exp $
+ * $Id: StgTicky.h,v 1.6 1999/09/14 12:16:39 simonmar Exp $
  *
  * (c) The AQUA project, Glasgow University, 1994-1997
  * (c) The GHC Team, 1998-1999
@@ -239,11 +239,10 @@ extern struct ent_counter *ticky_entry_ctrs;
    
    Macro                               Where
    -----------------------     --------------------------------------------
-   TICK_UPD_EXISTING           Updating with an indirection to something
-                               already in the heap
    TICK_UPD_SQUEEZED           Same as UPD_EXISTING but because
                                of stack-squeezing
    TICK_UPD_CON_IN_NEW         Allocating a new CON
+   TICK_UPD_CON_IN_PLACE       Updating with a PAP in place
    TICK_UPD_PAP_IN_NEW         Allocating a new PAP
    TICK_UPD_PAP_IN_PLACE       Updating with a PAP in place
 
@@ -254,12 +253,14 @@ extern struct ent_counter *ticky_entry_ctrs;
          __idx = (n);                                           \
         UPD_##categ##_hst[((__idx > 8) ? 8 : __idx)] += 1;} 
 
-#define TICK_UPD_EXISTING()            UPD_EXISTING_ctr++
 #define TICK_UPD_SQUEEZED()            UPD_SQUEEZED_ctr++
 
 #define TICK_UPD_CON_IN_NEW(n)         UPD_CON_IN_NEW_ctr++ ; \
                                        TICK_UPD_HISTO(CON_IN_NEW,n)
 
+#define TICK_UPD_CON_IN_PLACE(n)       UPD_CON_IN_PLACE_ctr++; \
+                                       TICK_UPD_HISTO(CON_IN_PLACE,n)
+
 #define TICK_UPD_PAP_IN_NEW(n)         UPD_PAP_IN_NEW_ctr++ ; \
                                        TICK_UPD_HISTO(PAP_IN_NEW,n)
 
@@ -495,9 +496,9 @@ EXTERN unsigned long CATCHF_PUSHED_ctr INIT(0);
 EXTERN unsigned long UPDF_RCC_PUSHED_ctr INIT(0);
 EXTERN unsigned long UPDF_RCC_OMITTED_ctr INIT(0);
 
-EXTERN unsigned long UPD_EXISTING_ctr INIT(0);
 EXTERN unsigned long UPD_SQUEEZED_ctr INIT(0);
 EXTERN unsigned long UPD_CON_IN_NEW_ctr INIT(0);
+EXTERN unsigned long UPD_CON_IN_PLACE_ctr INIT(0);
 EXTERN unsigned long UPD_PAP_IN_NEW_ctr INIT(0);
 EXTERN unsigned long UPD_PAP_IN_PLACE_ctr INIT(0);
 
@@ -506,6 +507,11 @@ EXTERN unsigned long UPD_CON_IN_NEW_hst[9]
    = {0,0,0,0,0,0,0,0,0}
 #endif
 ;
+EXTERN unsigned long UPD_CON_IN_PLACE_hst[9]
+#ifdef TICKY_C
+   = {0,0,0,0,0,0,0,0,0}
+#endif
+;
 EXTERN unsigned long UPD_PAP_IN_NEW_hst[9]
 #ifdef TICKY_C
    = {0,0,0,0,0,0,0,0,0}
@@ -583,9 +589,9 @@ EXTERN unsigned long GC_WORDS_COPIED_ctr INIT(0);
 #define TICK_UPDF_RCC_PUSHED()
 #define TICK_UPDF_RCC_OMITTED()
 
-#define TICK_UPD_EXISTING()
 #define TICK_UPD_SQUEEZED()
 #define TICK_UPD_CON_IN_NEW(n)
+#define TICK_UPD_CON_IN_PLACE(n)
 #define TICK_UPD_PAP_IN_NEW(n)
 #define TICK_UPD_PAP_IN_PLACE()
 
index 1828aa8..81bad57 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Ticky.c,v 1.8 1999/06/24 13:10:32 simonmar Exp $
+ * $Id: Ticky.c,v 1.9 1999/09/14 12:16:36 simonmar Exp $
  *
  * (c) The AQUA project, Glasgow University, 1992-1997
  * (c) The GHC Team, 1998-1999
@@ -81,9 +81,10 @@ PrintTickyInfo(void)
 
   unsigned long tot_returns_of_new = RET_NEW_ctr;
 
+  unsigned long con_updates = UPD_CON_IN_NEW_ctr + UPD_CON_IN_PLACE_ctr;
   unsigned long pap_updates = UPD_PAP_IN_NEW_ctr + UPD_PAP_IN_PLACE_ctr;
 
-  unsigned long tot_updates = UPD_EXISTING_ctr + UPD_SQUEEZED_ctr + pap_updates;
+  unsigned long tot_updates = UPD_SQUEEZED_ctr + pap_updates + con_updates;
 
   unsigned long tot_new_updates   = UPD_NEW_IND_ctr + UPD_NEW_PERM_IND_ctr;
   unsigned long tot_old_updates   = UPD_OLD_IND_ctr + UPD_OLD_PERM_IND_ctr;
@@ -241,30 +242,33 @@ PrintTickyInfo(void)
        UPDF_RCC_OMITTED_ctr);
 
   fprintf(tf,"\nUPDATES: %ld\n", tot_updates);
-  fprintf(tf,"%7ld (%5.1f%%) data values\n",
-       UPD_CON_IN_NEW_ctr,
-       PC(INTAVG(UPD_CON_IN_NEW_ctr,tot_updates)));
+  fprintf(tf,"%7ld (%5.1f%%) data values\n\t\t  [%ld in place, %ld allocated new space]\n",
+       con_updates,
+       PC(INTAVG(con_updates,tot_updates)),
+       UPD_CON_IN_PLACE_ctr, UPD_CON_IN_NEW_ctr);
   fprintf(tf,"%7ld (%5.1f%%) partial applications\n\t\t  [%ld in place, %ld allocated new space]\n",
        pap_updates,
        PC(INTAVG(pap_updates,tot_updates)),
        UPD_PAP_IN_PLACE_ctr, UPD_PAP_IN_NEW_ctr);
-  fprintf(tf,"%7ld (%5.1f%%) updates to existing heap objects (%ld by squeezing)\n",
-       UPD_EXISTING_ctr + UPD_SQUEEZED_ctr,
-       PC(INTAVG(UPD_EXISTING_ctr + UPD_SQUEEZED_ctr, tot_updates)),
-       UPD_SQUEEZED_ctr);
+  fprintf(tf,"%7ld (%5.1f%%) updates by squeezing\n",
+       UPD_SQUEEZED_ctr,
+       PC(INTAVG(UPD_SQUEEZED_ctr, tot_updates)));
 
-  fprintf(tf, "UPD_CON_IN_NEW:   %7ld: ", UPD_CON_IN_NEW_ctr);
+  fprintf(tf, "\nUPD_CON_IN_NEW:   %7ld: ", UPD_CON_IN_NEW_ctr);
   for (i = 0; i < 9; i++) { fprintf(tf, "%7ld", UPD_CON_IN_NEW_hst[i]); }
   fprintf(tf, "\n");
+  fprintf(tf, "UPD_CON_IN_PLACE: %7ld: ", UPD_CON_IN_PLACE_ctr);
+  for (i = 0; i < 9; i++) { fprintf(tf, "%7ld", UPD_CON_IN_PLACE_hst[i]); }
+  fprintf(tf, "\n");
   fprintf(tf, "UPD_PAP_IN_NEW:   %7ld: ", UPD_PAP_IN_NEW_ctr);
   for (i = 0; i < 9; i++) { fprintf(tf, "%7ld", UPD_PAP_IN_NEW_hst[i]); }
   fprintf(tf, "\n");
 
   if (tot_gengc_updates != 0) {
-      fprintf(tf,"\nNEW GEN UPDATES: %ld (%5.1f%%)\n",
+      fprintf(tf,"\nNEW GEN UPDATES: %9ld (%5.1f%%)\n",
              tot_new_updates,
              PC(INTAVG(tot_new_updates,tot_gengc_updates)));
-      fprintf(tf,"\nOLD GEN UPDATES: %ld (%5.1f%%)\n",
+      fprintf(tf,"OLD GEN UPDATES: %9ld (%5.1f%%)\n",
              tot_old_updates,
              PC(INTAVG(tot_old_updates,tot_gengc_updates)));
   }
@@ -488,9 +492,9 @@ PrintTickyInfo(void)
   PR_CTR(UPDF_RCC_PUSHED_ctr);
   PR_CTR(UPDF_RCC_OMITTED_ctr);
 
-  PR_CTR(UPD_EXISTING_ctr);
   PR_CTR(UPD_SQUEEZED_ctr);
   PR_CTR(UPD_CON_IN_NEW_ctr);
+  PR_CTR(UPD_CON_IN_PLACE_ctr);
   PR_CTR(UPD_PAP_IN_NEW_ctr);
   PR_CTR(UPD_PAP_IN_PLACE_ctr);
 
index 5c64e4d..aad6dc1 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Updates.hc,v 1.18 1999/07/06 16:40:28 sewardj Exp $
+ * $Id: Updates.hc,v 1.19 1999/09/14 12:16:36 simonmar Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
        {                                                               \
           StgClosure *updatee;                                         \
          FB_                                                           \
-         /* tick - ToDo: check this is right */                        \
-         TICK_UPD_EXISTING();                                          \
                                                                        \
           updatee = ((StgUpdateFrame *)Sp)->updatee;                   \
-                                               \
+                                                                       \
+         /* Tick - it must be a con, all the paps are handled          \
+          * in stg_upd_PAP and PAP_entry below                         \
+          */                                                           \
+         TICK_UPD_CON_IN_NEW(sizeW_fromITBL(get_itbl(updatee)));       \
+                                                                       \
          /* update the updatee with an indirection to the return value */\
          UPD_IND(updatee,R1.p);                                        \
                                                                        \
          FE_                                                           \
        }
 
-//UPD_FRAME_ENTRY_TEMPLATE(Upd_frame_entry,ENTRY_CODE(Sp[0]));
-        STGFUN(Upd_frame_entry);                                                       
-       STGFUN(Upd_frame_entry)                                                 
-       {                                                               
-          StgClosure *updatee;                                         
-         FB_                                                           
-         /* tick - ToDo: check this is right */                        
-         TICK_UPD_EXISTING();                                          
-                                                                       
-          updatee = ((StgUpdateFrame *)Sp)->updatee;                   
-                                               
-         /* update the updatee with an indirection to the return value */
-         UPD_IND(updatee,R1.p);                                        
-                                                                       
-         /* reset Su to the next update frame */                       
-         Su = ((StgUpdateFrame *)Sp)->link;                            
-                                                                       
-         /* remove the update frame from the stack */                  
-         Sp += sizeofW(StgUpdateFrame);                                
-                                                                       
-         JMP_(ENTRY_CODE(Sp[0]));                                                      
-         FE_                                                           
-       }
-
-
+UPD_FRAME_ENTRY_TEMPLATE(Upd_frame_entry,ENTRY_CODE(Sp[0]));
 UPD_FRAME_ENTRY_TEMPLATE(Upd_frame_0_entry,RET_VEC(Sp[0],0));
 UPD_FRAME_ENTRY_TEMPLATE(Upd_frame_1_entry,RET_VEC(Sp[0],1));
 UPD_FRAME_ENTRY_TEMPLATE(Upd_frame_2_entry,RET_VEC(Sp[0],2));