Fix histograms for ticky code
authorMateusz Lenik <mlen@mlen.pl>
Tue, 17 May 2016 06:33:54 +0000 (08:33 +0200)
committerBen Gamari <ben@smart-cactus.org>
Wed, 18 May 2016 18:14:31 +0000 (20:14 +0200)
This patch fixes Cmm generation required to produce histograms when
compiling with -ticky flag, strips dead code from rts/Ticky.c and
reworks it to use a shared constant in both C and Haskell code.

Fixes #8308.

Test Plan: T8308

Reviewers: jstolarek, simonpj, austin

Reviewed By: simonpj

Subscribers: mpickering, simonpj, bgamari, mlen, thomie, jstolarek

Differential Revision: https://phabricator.haskell.org/D931

GHC Trac Issues: #8308

compiler/codeGen/StgCmmExpr.hs
compiler/codeGen/StgCmmTicky.hs
includes/stg/Ticky.h
rts/RtsSymbols.c
rts/Ticky.c
testsuite/tests/rts/T8308/Makefile [new file with mode: 0644]
testsuite/tests/rts/T8308/T8308.hs [new file with mode: 0644]
testsuite/tests/rts/T8308/T8308.stdout [new file with mode: 0644]
testsuite/tests/rts/T8308/all.T [new file with mode: 0644]
utils/deriveConstants/Main.hs

index 86b3aec..a472191 100644 (file)
@@ -680,6 +680,7 @@ cgConApp con stg_args
                 -- it only affects profiling (hence the False)
 
         ; emit =<< fcode_init
+        ; tickyReturnNewCon (length stg_args)
         ; emitReturn [idInfoToAmode idinfo] }
 
 cgIdApp :: Id -> [StgArg] -> FCode ReturnKind
index d4f352c..273e9c0 100644 (file)
@@ -97,7 +97,7 @@ module StgCmmTicky (
 
   tickyUpdateBhCaf,
   tickyBlackHole,
-  tickyUnboxedTupleReturn, tickyVectoredReturn,
+  tickyUnboxedTupleReturn,
   tickyReturnOldCon, tickyReturnNewCon,
 
   tickyKnownCallTooFewArgs, tickyKnownCallExact, tickyKnownCallExtraArgs,
@@ -376,11 +376,6 @@ tickyUnboxedTupleReturn arity
   = ifTicky $ do { bumpTickyCounter (fsLit "RET_UNBOXED_TUP_ctr")
                  ; bumpHistogram    (fsLit "RET_UNBOXED_TUP_hst") arity }
 
-tickyVectoredReturn :: Int -> FCode ()
-tickyVectoredReturn family_size
-  = ifTicky $ do { bumpTickyCounter (fsLit "VEC_RETURN_ctr")
-                 ; bumpHistogram    (fsLit "RET_VEC_RETURN_hst") family_size }
-
 -- -----------------------------------------------------------------------------
 -- Ticky calls
 
@@ -615,26 +610,15 @@ bumpTickyLitByE lhs e = do
   emit (addToMemE (bWord dflags) (CmmLit lhs) e)
 
 bumpHistogram :: FastString -> Int -> FCode ()
-bumpHistogram _lbl _n
---  = bumpHistogramE lbl (CmmLit (CmmInt (fromIntegral n) cLongWidth))
-    = return ()    -- TEMP SPJ Apr 07
-                   -- six years passed - still temp? JS Aug 2013
-
-{-
-bumpHistogramE :: LitString -> CmmExpr -> FCode ()
-bumpHistogramE lbl n
-  = do  t <- newTemp cLong
-        emitAssign (CmmLocal t) n
-        emit (mkCmmIfThen (CmmMachOp (MO_U_Le cLongWidth) [CmmReg (CmmLocal t), eight])
-                          (mkAssign (CmmLocal t) eight))
-        emit (addToMem cLong
-                       (cmmIndexExpr cLongWidth
-                                (CmmLit (CmmLabel (mkRtsDataLabel lbl)))
-                                (CmmReg (CmmLocal t)))
-                       1)
-  where
-   eight = CmmLit (CmmInt 8 cLongWidth)
--}
+bumpHistogram lbl n = do
+    dflags <- getDynFlags
+    let offset = n `min` (tICKY_BIN_COUNT dflags - 1)
+    emit (addToMem (cLong dflags)
+           (cmmIndexExpr dflags
+                (cLongWidth dflags)
+                (CmmLit (CmmLabel (mkCmmDataLabel rtsUnitId lbl)))
+                (CmmLit (CmmInt (fromIntegral offset) (cLongWidth dflags))))
+           1)
 
 ------------------------------------------------------------------
 -- Showing the "type category" for ticky-ticky profiling
@@ -671,7 +655,7 @@ showTypeCategory ty
   | otherwise = case tcSplitTyConApp_maybe ty of
   Nothing -> '.'
   Just (tycon, _) ->
-    (if isUnliftedTyCon tycon then Data.Char.toLower else \x -> x) $
+    (if isUnliftedTyCon tycon then Data.Char.toLower else id) $
     let anyOf us = getUnique tycon `elem` us in
     case () of
       _ | anyOf [funTyConKey] -> '>'
index 08517c5..5143c2f 100644 (file)
@@ -11,7 +11,6 @@
  *
  * -------------------------------------------------------------------------- */
 
-
 #ifndef TICKYCOUNTERS_H
 #define TICKYCOUNTERS_H
 
@@ -180,9 +179,17 @@ EXTERN StgInt RET_OLD_ctr INIT(0);
 EXTERN StgInt RET_UNBOXED_TUP_ctr INIT(0);
 
 EXTERN StgInt RET_SEMI_loads_avoided INIT(0);
-
 /* End of counter declarations. */
 
+/* How many bins in ticky's histograms */
+#define TICKY_BIN_COUNT 9
+
+/* Histogram declarations */
+EXTERN StgInt RET_NEW_hst[TICKY_BIN_COUNT] INIT({0});
+EXTERN StgInt RET_OLD_hst[TICKY_BIN_COUNT] INIT({0});
+EXTERN StgInt RET_UNBOXED_TUP_hst[TICKY_BIN_COUNT] INIT({0});
+/* End of histogram declarations */
+
 /* This is ugly, but the story is:
    We got rid of StgTicky.h, which was previously
    defining these macros for the benefit of C code
index 3e82cdf..11bc0e6 100644 (file)
       SymI_HasProto(RET_NEW_ctr)                        \
       SymI_HasProto(RET_OLD_ctr)                        \
       SymI_HasProto(RET_UNBOXED_TUP_ctr)                \
-      SymI_HasProto(RET_SEMI_loads_avoided)
+      SymI_HasProto(RET_SEMI_loads_avoided)             \
+      SymI_HasProto(RET_NEW_hst)                        \
+      SymI_HasProto(RET_OLD_hst)                        \
+      SymI_HasProto(RET_UNBOXED_TUP_hst)
 
 
 // On most platforms, the garbage collector rewrites references
index ec2e73b..cb3651d 100644 (file)
@@ -46,34 +46,7 @@ static void printRegisteredCounterInfo (FILE *); /* fwd decl */
 void
 PrintTickyInfo(void)
 {
-  // XXX This is only used in commented out or #if FALSE'd out code currently:
-  // unsigned long i;
-
-/* XXX These are used only in an #if FALSE block below */
-#if FALSE
-  unsigned long tot_allocs = /* total number of things allocated */
-        ALLOC_FUN_ctr + ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr + ALLOC_CON_ctr + ALLOC_TUP_ctr +
-        + ALLOC_TSO_ctr + ALLOC_BH_ctr  + ALLOC_PAP_ctr + ALLOC_PRIM_ctr
-      ;
-
-  unsigned long tot_adm_wds = /* total number of admin words allocated */
-        ALLOC_FUN_adm + ALLOC_THK_adm + ALLOC_CON_adm + ALLOC_TUP_adm
-        + ALLOC_TSO_adm + ALLOC_BH_adm  + ALLOC_PAP_adm + ALLOC_PRIM_adm
-      ;
-
-  unsigned long tot_gds_wds = /* total number of words of ``good stuff'' allocated */
-        ALLOC_FUN_gds + ALLOC_THK_gds + ALLOC_CON_gds + ALLOC_TUP_gds
-        + ALLOC_TSO_gds + ALLOC_BH_gds  + ALLOC_PAP_gds + ALLOC_PRIM_gds
-      ;
-
-  unsigned long tot_slp_wds = /* total number of ``slop'' words allocated */
-        ALLOC_FUN_slp + ALLOC_THK_slp + ALLOC_CON_slp + ALLOC_TUP_slp
-        + ALLOC_TSO_slp + ALLOC_BH_slp  + ALLOC_PAP_slp + ALLOC_PRIM_slp
-      ;
-
-  unsigned long tot_wds = /* total words */
-        tot_adm_wds + tot_gds_wds + tot_slp_wds;
-#endif
+  unsigned long i;
 
   unsigned long tot_thk_enters = ENT_STATIC_THK_MANY_ctr + ENT_DYN_THK_MANY_ctr
                                + ENT_STATIC_THK_SINGLE_ctr + ENT_DYN_THK_SINGLE_ctr;
@@ -82,17 +55,6 @@ PrintTickyInfo(void)
   unsigned long tot_fun_direct_enters = ENT_STATIC_FUN_DIRECT_ctr + ENT_DYN_FUN_DIRECT_ctr;
   unsigned long tot_ind_enters = ENT_STATIC_IND_ctr + ENT_DYN_IND_ctr;
 
-  // This is the number of times we entered a function via some kind
-  // of slow call.  It amounts to all the slow applications, not
-  // counting those that were to too few arguments.
-  /*
-  XXX This us unused - can we delete it? -- IGL 2008-04-25
-  unsigned long tot_fun_slow_enters =
-      SLOW_CALL_ctr -
-      SLOW_CALL_FUN_TOO_FEW_ctr -
-      SLOW_CALL_PAP_TOO_FEW_ctr;
-  */
-
   unsigned long tot_known_calls =
       KNOWN_CALL_ctr + KNOWN_CALL_TOO_FEW_ARGS_ctr +
       + KNOWN_CALL_EXTRA_ARGS_ctr;
@@ -130,78 +92,6 @@ PrintTickyInfo(void)
   if( tf == NULL )
     tf = stderr;
 
-  /* krc: avoid dealing with this just now */
-#if FALSE
-  fprintf(tf,"\n\nALLOCATIONS: %ld (%ld words total: %ld admin, %ld goods, %ld slop)\n",
-          tot_allocs, tot_wds, tot_adm_wds, tot_gds_wds, tot_slp_wds);
-  fprintf(tf,"\t\t\t\ttotal words:\t    2     3     4     5    6+\n");
-
-#define ALLOC_HISTO_MAGIC(categ) \
-        (PC(INTAVG(ALLOC_##categ##_hst[0], ALLOC_##categ##_ctr))), \
-        (PC(INTAVG(ALLOC_##categ##_hst[1], ALLOC_##categ##_ctr))), \
-        (PC(INTAVG(ALLOC_##categ##_hst[2], ALLOC_##categ##_ctr))), \
-        (PC(INTAVG(ALLOC_##categ##_hst[3], ALLOC_##categ##_ctr))), \
-        (PC(INTAVG(ALLOC_##categ##_hst[4], ALLOC_##categ##_ctr)))
-
-  fprintf(tf,"%11ld (%5.1f%%) function values",
-        ALLOC_FUN_ctr,
-        PC(INTAVG(ALLOC_FUN_ctr, tot_allocs)));
-  if (ALLOC_FUN_ctr != 0)
-      fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(FUN));
-
-
-  fprintf(tf,"\n%11ld (%5.1f%%) thunks",
-        ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr,
-        PC(INTAVG(ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr, tot_allocs)));
-
-#define ALLOC_THK_ctr (ALLOC_UP_THK_ctr + ALLOC_SE_THK_ctr)
-  /* hack to make ALLOC_HISTO_MAGIC still work for THK */
-  if ((ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr) != 0)
-      fprintf(tf,"\t\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(THK));
-#undef ALLOC_THK_ctr
-
-  fprintf(tf,"\n%11ld (%5.1f%%) data values",
-        ALLOC_CON_ctr,
-        PC(INTAVG(ALLOC_CON_ctr, tot_allocs)));
-  if (ALLOC_CON_ctr != 0)
-      fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(CON));
-
-  fprintf(tf,"\n%11ld (%5.1f%%) big tuples",
-        ALLOC_TUP_ctr,
-        PC(INTAVG(ALLOC_TUP_ctr, tot_allocs)));
-  if (ALLOC_TUP_ctr != 0)
-      fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(TUP));
-
-  fprintf(tf,"\n%11ld (%5.1f%%) black holes",
-        ALLOC_BH_ctr,
-        PC(INTAVG(ALLOC_BH_ctr, tot_allocs)));
-  if (ALLOC_BH_ctr != 0)
-      fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(BH));
-
-  fprintf(tf,"\n%11ld (%5.1f%%) prim things",
-        ALLOC_PRIM_ctr,
-        PC(INTAVG(ALLOC_PRIM_ctr, tot_allocs)));
-  if (ALLOC_PRIM_ctr != 0)
-      fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(PRIM));
-
-  fprintf(tf,"\n%11ld (%5.1f%%) partial applications",
-        ALLOC_PAP_ctr,
-        PC(INTAVG(ALLOC_PAP_ctr, tot_allocs)));
-  if (ALLOC_PAP_ctr != 0)
-      fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(PAP));
-
-  fprintf(tf,"\n%11ld (%5.1f%%) thread state objects",
-        ALLOC_TSO_ctr,
-        PC(INTAVG(ALLOC_TSO_ctr, tot_allocs)));
-  if (ALLOC_TSO_ctr != 0)
-      fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(TSO));
-
-  fprintf(tf,"\n");
-
-  fprintf(tf,"\nTotal storage-manager allocations: %ld (%ld words)\n\t[%ld words lost to speculative heap-checks]\n", ALLOC_HEAP_ctr, ALLOC_HEAP_tot, ALLOC_HEAP_tot - tot_wds);
-#endif /* FALSE */
-
-
   fprintf(tf,"\nSTACK USAGE:\n"); /* NB: some bits are direction sensitive */
 
 
@@ -244,23 +134,25 @@ PrintTickyInfo(void)
         tot_returns_of_new,
         PC(INTAVG(tot_returns_of_new,tot_returns)));
 
-  /* krc: comment out some of this stuff temporarily */
 
-  /*
   fprintf(tf, "\nRET_NEW:         %11ld: ", RET_NEW_ctr);
-  for (i = 0; i < 9; i++) { fprintf(tf, "%5.1f%%",
-                                PC(INTAVG(RET_NEW_hst[i],RET_NEW_ctr))); }
+  for (i = 0; i < TICKY_BIN_COUNT; i++) {
+    fprintf(tf, "%5.1f%%", PC(INTAVG(RET_NEW_hst[i], RET_NEW_ctr)));
+  }
   fprintf(tf, "\n");
+
   fprintf(tf, "RET_OLD:         %11ld: ", RET_OLD_ctr);
-  for (i = 0; i < 9; i++) { fprintf(tf, "%5.1f%%",
-                                PC(INTAVG(RET_OLD_hst[i],RET_OLD_ctr))); }
+  for (i = 0; i < TICKY_BIN_COUNT; i++) {
+    fprintf(tf, "%5.1f%%", PC(INTAVG(RET_OLD_hst[i], RET_OLD_ctr)));
+  }
   fprintf(tf, "\n");
+
   fprintf(tf, "RET_UNBOXED_TUP: %11ld: ", RET_UNBOXED_TUP_ctr);
-  for (i = 0; i < 9; i++) { fprintf(tf, "%5.1f%%",
-                                    PC(INTAVG(RET_UNBOXED_TUP_hst[i],
-                                              RET_UNBOXED_TUP_ctr))); }
+  for (i = 0; i < TICKY_BIN_COUNT; i++) {
+    fprintf(tf, "%5.1f%%", PC(INTAVG(RET_UNBOXED_TUP_hst[i],
+                           RET_UNBOXED_TUP_ctr)));
+  }
   fprintf(tf, "\n");
-  */
 
   fprintf(tf,"\nUPDATE FRAMES: %" FMT_Int " (%" FMT_Int " omitted from thunks)",
         UPDF_PUSHED_ctr,
@@ -268,37 +160,27 @@ PrintTickyInfo(void)
 
   fprintf(tf,"\nCATCH FRAMES:  %" FMT_Int "", CATCHF_PUSHED_ctr);
 
-  if (UPDF_RCC_PUSHED_ctr != 0)
+  if (UPDF_RCC_PUSHED_ctr != 0) {
      fprintf(tf,"%11" FMT_Int " restore cost centre frames (%" FMT_Int " omitted)\n",
         UPDF_RCC_PUSHED_ctr,
         UPDF_RCC_OMITTED_ctr);
+  }
 
   fprintf(tf,"\nUPDATES: %ld\n", tot_updates);
   fprintf(tf,"%11ld (%5.1f%%) data values\n\t\t  [%" FMT_Int " in place, %" FMT_Int " allocated new space]\n",
         con_updates,
         PC(INTAVG(con_updates,tot_updates)),
         UPD_CON_IN_PLACE_ctr, UPD_CON_IN_NEW_ctr);
+
   fprintf(tf,"%11ld (%5.1f%%) partial applications\n\t\t  [%" FMT_Int " in place, %" FMT_Int " allocated new space]\n",
         pap_updates,
         PC(INTAVG(pap_updates,tot_updates)),
         UPD_PAP_IN_PLACE_ctr, UPD_PAP_IN_NEW_ctr);
+
   fprintf(tf,"%11" FMT_Int " (%5.1f%%) updates by squeezing\n",
         UPD_SQUEEZED_ctr,
         PC(INTAVG(UPD_SQUEEZED_ctr, tot_updates)));
 
-  /* krc: also avoid dealing with this for now */
-#if FALSE
-  fprintf(tf, "\nUPD_CON_IN_NEW:   %11ld: ", UPD_CON_IN_NEW_ctr);
-  for (i = 0; i < 9; i++) { fprintf(tf, "%11ld", UPD_CON_IN_NEW_hst[i]); }
-  fprintf(tf, "\n");
-  fprintf(tf, "UPD_CON_IN_PLACE: %11ld: ", UPD_CON_IN_PLACE_ctr);
-  for (i = 0; i < 9; i++) { fprintf(tf, "%11ld", UPD_CON_IN_PLACE_hst[i]); }
-  fprintf(tf, "\n");
-  fprintf(tf, "UPD_PAP_IN_NEW:   %11ld: ", UPD_PAP_IN_NEW_ctr);
-  for (i = 0; i < 9; i++) { fprintf(tf, "%11ld", UPD_PAP_IN_NEW_hst[i]); }
-  fprintf(tf, "\n");
-#endif
-
   if (tot_gengc_updates != 0) {
       fprintf(tf,"\nNEW GEN UPDATES: %9ld (%5.1f%%)\n",
               tot_new_updates,
@@ -319,9 +201,11 @@ PrintTickyInfo(void)
 
 #define PR_CTR(ctr) \
   do { fprintf(tf,"%11" FMT_Int " " #ctr "\n", ctr); } while(0)
+
 /* COND_PR_CTR takes a boolean; if false then msg is the printname rather than ctr */
 #define COND_PR_CTR(ctr,b,msg) \
     if (b) { fprintf(tf,"%11" FMT_Int " " #ctr "\n", ctr); } else { fprintf(tf,"%11" FMT_Int " " msg "\n", ctr); }
+
 #define PR_HST(hst,i) \
   do { fprintf(tf,"%11ld " #hst "_" #i "\n", hst[i]); } while(0)
 
@@ -355,76 +239,6 @@ PrintTickyInfo(void)
   PR_CTR(ALLOC_PRIM_gds);
   PR_CTR(ALLOC_PRIM_slp);
 
-  /* krc: comment out some of this stuff temporarily
-  PR_HST(ALLOC_FUN_hst,0);
-  PR_HST(ALLOC_FUN_hst,1);
-  PR_HST(ALLOC_FUN_hst,2);
-  PR_HST(ALLOC_FUN_hst,3);
-  PR_HST(ALLOC_FUN_hst,4);
-  PR_CTR(ALLOC_UP_THK_ctr);
-  PR_CTR(ALLOC_SE_THK_ctr);
-  PR_CTR(ALLOC_THK_adm);
-  PR_CTR(ALLOC_THK_gds);
-  PR_CTR(ALLOC_THK_slp);
-  PR_HST(ALLOC_THK_hst,0);
-  PR_HST(ALLOC_THK_hst,1);
-  PR_HST(ALLOC_THK_hst,2);
-  PR_HST(ALLOC_THK_hst,3);
-  PR_HST(ALLOC_THK_hst,4);
-  PR_CTR(ALLOC_CON_ctr);
-  PR_CTR(ALLOC_CON_adm);
-  PR_CTR(ALLOC_CON_gds);
-  PR_CTR(ALLOC_CON_slp);
-  PR_HST(ALLOC_CON_hst,0);
-  PR_HST(ALLOC_CON_hst,1);
-  PR_HST(ALLOC_CON_hst,2);
-  PR_HST(ALLOC_CON_hst,3);
-  PR_HST(ALLOC_CON_hst,4);
-  PR_CTR(ALLOC_TUP_ctr);
-  PR_CTR(ALLOC_TUP_adm);
-  PR_CTR(ALLOC_TUP_gds);
-  PR_CTR(ALLOC_TUP_slp);
-  PR_HST(ALLOC_TUP_hst,0);
-  PR_HST(ALLOC_TUP_hst,1);
-  PR_HST(ALLOC_TUP_hst,2);
-  PR_HST(ALLOC_TUP_hst,3);
-  PR_HST(ALLOC_TUP_hst,4);
-  PR_CTR(ALLOC_BH_ctr);
-  PR_CTR(ALLOC_BH_adm);
-  PR_CTR(ALLOC_BH_gds);
-  PR_CTR(ALLOC_BH_slp);
-  PR_HST(ALLOC_BH_hst,0);
-  PR_HST(ALLOC_BH_hst,1);
-  PR_HST(ALLOC_BH_hst,2);
-  PR_HST(ALLOC_BH_hst,3);
-  PR_HST(ALLOC_BH_hst,4);
-  PR_CTR(ALLOC_PRIM_ctr);
-  PR_CTR(ALLOC_PRIM_adm);
-  PR_CTR(ALLOC_PRIM_gds);
-  PR_CTR(ALLOC_PRIM_slp);
-  PR_HST(ALLOC_PRIM_hst,0);
-  PR_HST(ALLOC_PRIM_hst,1);
-  PR_HST(ALLOC_PRIM_hst,2);
-  PR_HST(ALLOC_PRIM_hst,3);
-  PR_HST(ALLOC_PRIM_hst,4);
-  PR_CTR(ALLOC_PAP_slp);
-  PR_HST(ALLOC_PAP_hst,0);
-  PR_HST(ALLOC_PAP_hst,1);
-  PR_HST(ALLOC_PAP_hst,2);
-  PR_HST(ALLOC_PAP_hst,3);
-  PR_HST(ALLOC_PAP_hst,4);
-
-  PR_CTR(ALLOC_TSO_ctr);
-  PR_CTR(ALLOC_TSO_adm);
-  PR_CTR(ALLOC_TSO_gds);
-  PR_CTR(ALLOC_TSO_slp);
-  PR_HST(ALLOC_TSO_hst,0);
-  PR_HST(ALLOC_TSO_hst,1);
-  PR_HST(ALLOC_TSO_hst,2);
-  PR_HST(ALLOC_TSO_hst,3);
-  PR_HST(ALLOC_TSO_hst,4);
-  */
-
   PR_CTR(ENT_VIA_NODE_ctr);
   PR_CTR(ENT_STATIC_CON_ctr);
   PR_CTR(ENT_DYN_CON_ctr);
@@ -492,52 +306,18 @@ PrintTickyInfo(void)
   PR_CTR(SLOW_CALL_PAP_TOO_MANY_ctr);
   PR_CTR(SLOW_CALL_UNEVALD_ctr);
 
-  /* krc: put off till later... */
-#if FALSE
-  PR_HST(SLOW_CALL_hst,0);
-  PR_HST(SLOW_CALL_hst,1);
-  PR_HST(SLOW_CALL_hst,2);
-  PR_HST(SLOW_CALL_hst,3);
-  PR_HST(SLOW_CALL_hst,4);
-  PR_HST(SLOW_CALL_hst,5);
-  PR_HST(SLOW_CALL_hst,6);
-  PR_HST(SLOW_CALL_hst,7);
-#endif
-
   PR_CTR(RET_NEW_ctr);
   PR_CTR(RET_OLD_ctr);
   PR_CTR(RET_UNBOXED_TUP_ctr);
 
-  /* krc: put off till later... */
-#if FALSE
-  PR_HST(RET_NEW_hst,0);
-  PR_HST(RET_NEW_hst,1);
-  PR_HST(RET_NEW_hst,2);
-  PR_HST(RET_NEW_hst,3);
-  PR_HST(RET_NEW_hst,4);
-  PR_HST(RET_NEW_hst,5);
-  PR_HST(RET_NEW_hst,6);
-  PR_HST(RET_NEW_hst,7);
-  PR_HST(RET_NEW_hst,8);
-  PR_HST(RET_OLD_hst,0);
-  PR_HST(RET_OLD_hst,1);
-  PR_HST(RET_OLD_hst,2);
-  PR_HST(RET_OLD_hst,3);
-  PR_HST(RET_OLD_hst,4);
-  PR_HST(RET_OLD_hst,5);
-  PR_HST(RET_OLD_hst,6);
-  PR_HST(RET_OLD_hst,7);
-  PR_HST(RET_OLD_hst,8);
-  PR_HST(RET_UNBOXED_TUP_hst,0);
-  PR_HST(RET_UNBOXED_TUP_hst,1);
-  PR_HST(RET_UNBOXED_TUP_hst,2);
-  PR_HST(RET_UNBOXED_TUP_hst,3);
-  PR_HST(RET_UNBOXED_TUP_hst,4);
-  PR_HST(RET_UNBOXED_TUP_hst,5);
-  PR_HST(RET_UNBOXED_TUP_hst,6);
-  PR_HST(RET_UNBOXED_TUP_hst,7);
-  PR_HST(RET_UNBOXED_TUP_hst,8);
-#endif /* FALSE */
+#define PR_HST_BINS(hst) for (i = 0; i < TICKY_BIN_COUNT; i++) \
+  { fprintf(tf,"%11ld " #hst "_%lu\n", hst[i], i); }
+
+  PR_HST_BINS(RET_NEW_hst);
+  PR_HST_BINS(RET_OLD_hst);
+  PR_HST_BINS(RET_UNBOXED_TUP_hst);
+
+#undef PR_HST_BINS
 
   PR_CTR(UPDF_OMITTED_ctr);
   PR_CTR(UPDF_PUSHED_ctr);
@@ -552,29 +332,6 @@ PrintTickyInfo(void)
   PR_CTR(UPD_PAP_IN_NEW_ctr);
   PR_CTR(UPD_PAP_IN_PLACE_ctr);
 
-
-  /* krc: put off till later...*/
-#if FALSE
-  PR_HST(UPD_CON_IN_NEW_hst,0);
-  PR_HST(UPD_CON_IN_NEW_hst,1);
-  PR_HST(UPD_CON_IN_NEW_hst,2);
-  PR_HST(UPD_CON_IN_NEW_hst,3);
-  PR_HST(UPD_CON_IN_NEW_hst,4);
-  PR_HST(UPD_CON_IN_NEW_hst,5);
-  PR_HST(UPD_CON_IN_NEW_hst,6);
-  PR_HST(UPD_CON_IN_NEW_hst,7);
-  PR_HST(UPD_CON_IN_NEW_hst,8);
-  PR_HST(UPD_PAP_IN_NEW_hst,0);
-  PR_HST(UPD_PAP_IN_NEW_hst,1);
-  PR_HST(UPD_PAP_IN_NEW_hst,2);
-  PR_HST(UPD_PAP_IN_NEW_hst,3);
-  PR_HST(UPD_PAP_IN_NEW_hst,4);
-  PR_HST(UPD_PAP_IN_NEW_hst,5);
-  PR_HST(UPD_PAP_IN_NEW_hst,6);
-  PR_HST(UPD_PAP_IN_NEW_hst,7);
-  PR_HST(UPD_PAP_IN_NEW_hst,8);
-#endif /* FALSE */
-
   PR_CTR(UPD_NEW_IND_ctr);
   /* see comment on ENT_PERM_IND_ctr */
   COND_PR_CTR(UPD_NEW_PERM_IND_ctr,RtsFlags.GcFlags.squeezeUpdFrames == rtsFalse,"U!PD_NEW_PERM_IND_ctr requires +RTS -Z");
@@ -618,4 +375,3 @@ printRegisteredCounterInfo (FILE *tf)
     }
 }
 #endif /* TICKY_TICKY */
-
diff --git a/testsuite/tests/rts/T8308/Makefile b/testsuite/tests/rts/T8308/Makefile
new file mode 100644 (file)
index 0000000..e661be4
--- /dev/null
@@ -0,0 +1,10 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+T8308:
+       @'$(TEST_HC)' $(TEST_HC_OPTS) -v0 -rtsopts -ticky -O0 T8308.hs
+       @./T8308 +RTS -rT8308.ticky >/dev/null
+       @grep RET_NEW_hst_1 T8308.ticky | awk '{ print $$1 }'
+
+.PHONY: T8308
diff --git a/testsuite/tests/rts/T8308/T8308.hs b/testsuite/tests/rts/T8308/T8308.hs
new file mode 100644 (file)
index 0000000..b8bfeb9
--- /dev/null
@@ -0,0 +1,7 @@
+{-# LANGUAGE BangPatterns #-}
+data Test = Test !Int
+
+{-# NOINLINE f #-}
+f a = Test (a + 1)
+
+main = let (Test x) = f 1 in print x
diff --git a/testsuite/tests/rts/T8308/T8308.stdout b/testsuite/tests/rts/T8308/T8308.stdout
new file mode 100644 (file)
index 0000000..d00491f
--- /dev/null
@@ -0,0 +1 @@
+1
diff --git a/testsuite/tests/rts/T8308/all.T b/testsuite/tests/rts/T8308/all.T
new file mode 100644 (file)
index 0000000..cadbbcb
--- /dev/null
@@ -0,0 +1,2 @@
+test('T8308', [extra_clean(['T8308.ticky'])],
+     run_command, ['$MAKE -s --no-print-directory T8308'])
index 1878fd9..16f3255 100644 (file)
@@ -315,6 +315,9 @@ wanteds os = concat
           ,constantWord Both "BLOCKS_PER_MBLOCK" "BLOCKS_PER_MBLOCK"
            -- could be derived, but better to save doing the calculation twice
 
+          ,constantWord Both "TICKY_BIN_COUNT" "TICKY_BIN_COUNT"
+           -- number of bins for histograms used in ticky code
+
           ,fieldOffset Both "StgRegTable" "rR1"
           ,fieldOffset Both "StgRegTable" "rR2"
           ,fieldOffset Both "StgRegTable" "rR3"