[project @ 1999-05-11 16:47:39 by keithw]
authorkeithw <unknown>
Tue, 11 May 1999 16:48:00 +0000 (16:48 +0000)
committerkeithw <unknown>
Tue, 11 May 1999 16:48:00 +0000 (16:48 +0000)
(this is number 9 of 9 commits to be applied together)

  Usage verification changes / ticky-ticky changes:

  We want to verify that SingleEntry thunks are indeed entered at most
  once.  In order to do this, -ticky / -DTICKY_TICKY turns on eager
  blackholing.  We blackhole with new blackholes: SE_BLACKHOLE and
  SE_CAF_BLACKHOLE.  We will enter one of these if we attempt to enter
  a SingleEntry thunk twice.  Note that CAFs are dealt with in by
  codeGen, and ordinary thunks by the RTS.

  We also want to see how many times we enter each Updatable thunk.
  To this end, we have modified -ticky.  When -ticky is on, we update
  with a permanent indirection, and arrange that when we enter a
  permanent indirection we count the entry and then convert the
  indirection to a normal indirection.  This gives us a means of
  counting the number of thunks entered again after the first entry.
  Obviously this screws up profiling, and so you can't build a ticky
  and profiling compiler any more.

  Also a few other changes that didn't make it into the previous 8
  commits, but form a part of this set.

29 files changed:
ghc/includes/ClosureMacros.h
ghc/includes/ClosureTypes.h
ghc/includes/Closures.h
ghc/includes/StgMacros.h
ghc/includes/StgMiscClosures.h
ghc/includes/StgTicky.h
ghc/includes/TSO.h
ghc/includes/Updates.h
ghc/interpreter/adr.mk
ghc/lib/exts/Makefile
ghc/lib/misc/Makefile
ghc/lib/posix/Makefile
ghc/lib/std/Main.hi-boot
ghc/lib/std/Makefile
ghc/lib/std/PrelException.hi-boot
ghc/lib/std/PrelGHC.hi-boot
ghc/lib/std/PrelPack.hi-boot
ghc/rts/ClosureFlags.c
ghc/rts/Evaluator.c
ghc/rts/GC.c
ghc/rts/Printer.c
ghc/rts/RtsFlags.c
ghc/rts/RtsFlags.h
ghc/rts/Sanity.c
ghc/rts/Schedule.c
ghc/rts/StgMiscClosures.hc
ghc/rts/Storage.h
ghc/rts/Ticky.c
ghc/rts/Updates.hc

index bfafe9d..6d0bb6e 100644 (file)
@@ -1,5 +1,5 @@
 /* ----------------------------------------------------------------------------
- * $Id: ClosureMacros.h,v 1.14 1999/05/04 08:50:43 sof Exp $
+ * $Id: ClosureMacros.h,v 1.15 1999/05/11 16:47:39 keithw Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -265,9 +265,9 @@ static __inline__ StgWord tso_sizeW ( StgTSO *tso )
 #define SET_STATIC_PAR_HDR(stuff)
 #endif
 
-#ifdef TICKY
-#define SET_TICKY_HDR(c,stuff)         (c)->header.ticky.updated = stuff
-#define SET_STATIC_TICKY_HDR(stuff)    ticky : { updated : stuff }
+#ifdef TICKY_TICKY
+#define SET_TICKY_HDR(c,stuff)         /* old: (c)->header.ticky.updated = stuff */
+#define SET_STATIC_TICKY_HDR(stuff)    /* old: ticky : { updated : stuff } */
 #else
 #define SET_TICKY_HDR(c,stuff)
 #define SET_STATIC_TICKY_HDR(stuff)
index e53c3fe..de58fac 100644 (file)
@@ -1,5 +1,5 @@
 /* ----------------------------------------------------------------------------
- * $Id: ClosureTypes.h,v 1.10 1999/03/15 16:30:24 simonm Exp $
+ * $Id: ClosureTypes.h,v 1.11 1999/05/11 16:47:40 keithw Exp $
  * 
  * (c) The GHC Team, 1998-1999
  *
 #define SEQ_FRAME              46
 #define BLACKHOLE              47
 #define BLACKHOLE_BQ           48
-#define MVAR                   49
-#define ARR_WORDS              50
-#define MUT_ARR_PTRS           51
-#define MUT_ARR_PTRS_FROZEN     52
-#define MUT_VAR                        53
-#define WEAK                   54
-#define FOREIGN                        55
-#define STABLE_NAME            56
-#define TSO                    57
-#define BLOCKED_FETCH          58
-#define FETCH_ME                59
-#define EVACUATED               60
-#define N_CLOSURE_TYPES         61
+#define SE_BLACKHOLE           49
+#define SE_CAF_BLACKHOLE       50
+#define MVAR                   51
+#define ARR_WORDS              52
+#define MUT_ARR_PTRS           53
+#define MUT_ARR_PTRS_FROZEN     54
+#define MUT_VAR                        55
+#define WEAK                   56
+#define FOREIGN                        57
+#define STABLE_NAME            58
+#define TSO                    59
+#define BLOCKED_FETCH          60
+#define FETCH_ME                61
+#define EVACUATED               62
+#define N_CLOSURE_TYPES         63
 
 #endif CLOSURETYPES_H
index 17bcbf2..541c6ad 100644 (file)
@@ -1,5 +1,5 @@
 /* ----------------------------------------------------------------------------
- * $Id: Closures.h,v 1.12 1999/03/25 13:01:44 simonm Exp $
+ * $Id: Closures.h,v 1.13 1999/05/11 16:47:40 keithw Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -70,19 +70,19 @@ typedef struct {
    info tables to be @_Evacuate_1@ and @_Scavenge_1_0@.
    -------------------------------------------------------------------------- */
 
-#ifdef TICKY
+#ifdef TICKY_TICKY
 
 typedef struct {
-  W_ updated;
+  /* old: W_ updated; */
 } StgTickyHeader;
 
-#else /* !TICKY */
+#else /* !TICKY_TICKY */
 
 typedef struct {
        /* empty */
 } StgTickyHeader;
 
-#endif /* TICKY */
+#endif /* TICKY_TICKY */
 
 /* -----------------------------------------------------------------------------
    The full fixed-size closure header
@@ -99,7 +99,7 @@ typedef struct {
 #ifdef GRAN
        StgGranHeader         par;
 #endif
-#ifdef TICKY
+#ifdef TICKY_TICKY
        StgTickyHeader        ticky;
 #endif
 } StgHeader;
index 92feeae..4c7be2b 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: StgMacros.h,v 1.9 1999/04/28 12:42:45 sewardj Exp $
+ * $Id: StgMacros.h,v 1.10 1999/05/11 16:47:41 keithw Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -321,7 +321,6 @@ static inline int IS_ARG_TAG( StgWord p ) { return p <= ARGTAG_MAX; }
 #define R6_PTR   1<<5
 #define R7_PTR   1<<6
 #define R8_PTR   1<<7
-
 #define HP_CHK_GEN(headroom,liveness,reentry,tag_assts)        \
    if ((Hp += (headroom)) > HpLim ) {                  \
        EF_(stg_gen_chk);                               \
@@ -417,9 +416,17 @@ EDI_(stg_gen_chk_info);
 /* set the tag register (if we have one) */
 #define SET_TAG(t)  /* nothing */
 
-/* don't do eager blackholing for now */
-#define UPD_BH_UPDATABLE(thunk)  /* nothing */
-#define UPD_BH_SINGLE_ENTRY(thunk)  /* nothing */
+#ifdef EAGER_BLACKHOLING
+#  define UPD_BH_UPDATABLE(thunk)                        \
+        TICK_UPD_BH_UPDATABLE();                         \
+        SET_INFO((StgClosure *)thunk,&BLACKHOLE_info)
+#  define UPD_BH_SINGLE_ENTRY(thunk)                     \
+        TICK_UPD_BH_SINGLE_ENTRY();                      \
+        SET_INFO((StgClosure *)thunk,&SE_BLACKHOLE_info)
+#else /* !EAGER_BLACKHOLING */
+#  define UPD_BH_UPDATABLE(thunk)    /* nothing */
+#  define UPD_BH_SINGLE_ENTRY(thunk) /* nothing */
+#endif /* EAGER_BLACKHOLING */
 
 /* -----------------------------------------------------------------------------
    Moving Floats and Doubles
index daddd28..aad9895 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: StgMiscClosures.h,v 1.11 1999/03/02 19:44:20 sof Exp $
+ * $Id: StgMiscClosures.h,v 1.12 1999/05/11 16:47:41 keithw Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -24,6 +24,10 @@ STGFUN(CAF_ENTERED_entry);
 STGFUN(CAF_BLACKHOLE_entry);
 STGFUN(BLACKHOLE_entry);
 STGFUN(BLACKHOLE_BQ_entry);
+#ifdef TICKY_TICKY
+STGFUN(SE_BLACKHOLE_entry);
+STGFUN(SE_CAF_BLACKHOLE_entry);
+#endif
 STGFUN(BCO_entry);
 STGFUN(EVACUATED_entry);
 STGFUN(FOREIGN_entry);
@@ -55,6 +59,10 @@ extern DLL_IMPORT_RTS const StgInfoTable CAF_ENTERED_info;
 extern DLL_IMPORT_RTS const StgInfoTable CAF_BLACKHOLE_info;
 extern DLL_IMPORT_RTS const StgInfoTable BLACKHOLE_info;
 extern DLL_IMPORT_RTS const StgInfoTable BLACKHOLE_BQ_info;
+#ifdef TICKY_TICKY
+extern DLL_IMPORT_RTS const StgInfoTable SE_BLACKHOLE_info;
+extern DLL_IMPORT_RTS const StgInfoTable SE_CAF_BLACKHOLE_info;
+#endif
 extern DLL_IMPORT_RTS const StgInfoTable BCO_info;
 extern DLL_IMPORT_RTS const StgInfoTable EVACUATED_info;
 extern DLL_IMPORT_RTS const StgInfoTable FOREIGN_info;
@@ -97,6 +105,8 @@ extern DLL_IMPORT_DATA StgIntCharlikeClosure INTLIKE_closure[];
 
 extern StgFun stg_error_entry;
 
+  /* (see also below  -- KSW 1998-12) */
+
 /* standard selector thunks */
 
 #ifdef COMPILING_RTS
@@ -140,6 +150,43 @@ EI__ __sel_13_noupd_info;
 EI__ __sel_14_noupd_info;
 EI__ __sel_15_noupd_info;
 
+  /* and their standard entry points  -- KSW 1998-12 */
+
+EF_(__sel_0_upd_entry);
+EF_(__sel_1_upd_entry);
+EF_(__sel_2_upd_entry);
+EF_(__sel_3_upd_entry);
+EF_(__sel_4_upd_entry);
+EF_(__sel_5_upd_entry);
+EF_(__sel_6_upd_entry);
+EF_(__sel_7_upd_entry);
+EF_(__sel_8_upd_entry);
+EF_(__sel_8_upd_entry);
+EF_(__sel_9_upd_entry);
+EF_(__sel_10_upd_entry);
+EF_(__sel_11_upd_entry);
+EF_(__sel_12_upd_entry);
+EF_(__sel_13_upd_entry);
+EF_(__sel_14_upd_entry);
+EF_(__sel_15_upd_entry);
+
+EF_(__sel_0_noupd_entry);
+EF_(__sel_1_noupd_entry);
+EF_(__sel_2_noupd_entry);
+EF_(__sel_3_noupd_entry);
+EF_(__sel_4_noupd_entry);
+EF_(__sel_5_noupd_entry);
+EF_(__sel_6_noupd_entry);
+EF_(__sel_7_noupd_entry);
+EF_(__sel_8_noupd_entry);
+EF_(__sel_9_noupd_entry);
+EF_(__sel_10_noupd_entry);
+EF_(__sel_11_noupd_entry);
+EF_(__sel_12_noupd_entry);
+EF_(__sel_13_noupd_entry);
+EF_(__sel_14_noupd_entry);
+EF_(__sel_15_noupd_entry);
+
 /* standard ap thunks */
 
 EI__ __ap_1_upd_info;
index bd4fa1c..705fdfd 100644 (file)
@@ -1,5 +1,5 @@
 /* ----------------------------------------------------------------------------
- * $Id: StgTicky.h,v 1.3 1999/02/05 16:02:30 simonm Exp $
+ * $Id: StgTicky.h,v 1.4 1999/05/11 16:47:42 keithw Exp $
  *
  * (c) The AQUA project, Glasgow University, 1994-1997
  * (c) The GHC Team, 1998-1999
        ALLOC_FUN_gds += (g);   ALLOC_FUN_slp += (s);   \
        TICK_ALLOC_HISTO(FUN,_HS,g,s)
 
-#define TICK_ALLOC_THK(g,s)                            \
-       ALLOC_THK_ctr++;        ALLOC_THK_adm += _HS;   \
+#define TICK_ALLOC_UP_THK(g,s)                          \
+       ALLOC_UP_THK_ctr++;     ALLOC_THK_adm += _HS;   \
+       ALLOC_THK_gds += (g);   ALLOC_THK_slp += (s);   \
+       TICK_ALLOC_HISTO(THK,_HS,g,s)
+
+#define TICK_ALLOC_SE_THK(g,s)                          \
+       ALLOC_SE_THK_ctr++;     ALLOC_THK_adm += _HS;   \
        ALLOC_THK_gds += (g);   ALLOC_THK_slp += (s);   \
        TICK_ALLOC_HISTO(THK,_HS,g,s)
 
 
 #define TICK_ENT_CON(n)                ENT_CON_ctr++         /* enter constructor */
 #define TICK_ENT_IND(n)                ENT_IND_ctr++         /* enter indirection */
+#define TICK_ENT_PERM_IND(n)    ENT_PERM_IND_ctr++    /* enter permanent indirection */
 #define TICK_ENT_PAP(n)                ENT_PAP_ctr++         /* enter PAP */
 #define TICK_ENT_AP_UPD(n)     ENT_AP_UPD_ctr++      /* enter AP_UPD */
 #define TICK_ENT_BH()          ENT_BH_ctr++          /* enter BLACKHOLE */
 
+
 /* -----------------------------------------------------------------------------
    Returns
    -------------------------------------------------------------------------- */
    -------------------------------------------------------------------------- */
 
 #define TICK_UPDF_OMITTED()    UPDF_OMITTED_ctr++
-#define TICK_UPDF_PUSHED()     UPDF_PUSHED_ctr++
+#define TICK_UPDF_PUSHED(tgt,inf)      UPDF_PUSHED_ctr++ \
+/*                              ; fprintf(stderr,"UPDF_PUSHED:%p:%p\n",tgt,inf) */
 #define TICK_SEQF_PUSHED()      SEQF_PUSHED_ctr++
 #define TICK_CATCHF_PUSHED()    CATCHF_PUSHED_ctr++
 #define TICK_UPDF_RCC_PUSHED() UPDF_RCC_PUSHED_ctr++
 /* For the generational collector: 
  */
 #define TICK_UPD_NEW_IND()             UPD_NEW_IND_ctr++
+#define TICK_UPD_NEW_PERM_IND(tgt)     UPD_NEW_PERM_IND_ctr++ \
+/*                                      ; fprintf(stderr,"UPD_NEW_PERM:%p\n",tgt) */
 #define TICK_UPD_OLD_IND()             UPD_OLD_IND_ctr++                       
+#define TICK_UPD_OLD_PERM_IND()                UPD_OLD_PERM_IND_ctr++                  
+
+/* Count blackholes:
+ */
+#define TICK_UPD_BH_UPDATABLE()         UPD_BH_UPDATABLE_ctr++
+#define TICK_UPD_BH_SINGLE_ENTRY()      UPD_BH_SINGLE_ENTRY_ctr++
+#define TICK_UPD_CAF_BH_UPDATABLE(s)                          \
+     UPD_CAF_BH_UPDATABLE_ctr++                               \
+/*   ; fprintf(stderr,"TICK_UPD_CAF_BH_UPDATABLE(%s)\n",s) */
+#define TICK_UPD_CAF_BH_SINGLE_ENTRY(s)                       \
+     UPD_CAF_BH_SINGLE_ENTRY_ctr++                            \
+/*   ; fprintf(stderr,"TICK_UPD_CAF_BH_SINGLE_ENTRY(%s)\n",s) */
+
 
 /* -----------------------------------------------------------------------------
    Garbage collection counters
@@ -283,7 +306,8 @@ EXTERN unsigned long ALLOC_FUN_hst[5]
 #endif
 ;
 
-EXTERN unsigned long ALLOC_THK_ctr INIT(0);
+EXTERN unsigned long ALLOC_UP_THK_ctr INIT(0);
+EXTERN unsigned long ALLOC_SE_THK_ctr INIT(0);
 EXTERN unsigned long ALLOC_THK_adm INIT(0);
 EXTERN unsigned long ALLOC_THK_gds INIT(0);
 EXTERN unsigned long ALLOC_THK_slp INIT(0);
@@ -391,6 +415,7 @@ EXTERN unsigned long ENT_FUN_STD_ctr INIT(0);
 EXTERN unsigned long ENT_FUN_DIRECT_ctr INIT(0);
 EXTERN unsigned long ENT_CON_ctr INIT(0);
 EXTERN unsigned long ENT_IND_ctr INIT(0);
+EXTERN unsigned long ENT_PERM_IND_ctr INIT(0);
 EXTERN unsigned long ENT_PAP_ctr INIT(0);
 EXTERN unsigned long ENT_AP_UPD_ctr INIT(0);
 EXTERN unsigned long ENT_BH_ctr INIT(0);
@@ -458,7 +483,14 @@ EXTERN unsigned long UPD_PAP_IN_NEW_hst[9]
 ;
 
 EXTERN unsigned long UPD_NEW_IND_ctr INIT(0);
+EXTERN unsigned long UPD_NEW_PERM_IND_ctr INIT(0);
 EXTERN unsigned long UPD_OLD_IND_ctr INIT(0);
+EXTERN unsigned long UPD_OLD_PERM_IND_ctr INIT(0);
+
+EXTERN unsigned long UPD_BH_UPDATABLE_ctr INIT(0);
+EXTERN unsigned long UPD_BH_SINGLE_ENTRY_ctr INIT(0);
+EXTERN unsigned long UPD_CAF_BH_UPDATABLE_ctr INIT(0);
+EXTERN unsigned long UPD_CAF_BH_SINGLE_ENTRY_ctr INIT(0);
 
 EXTERN unsigned long GC_SEL_ABANDONED_ctr INIT(0);
 EXTERN unsigned long GC_SEL_MINOR_ctr INIT(0);
@@ -480,7 +512,8 @@ EXTERN unsigned long GC_WORDS_COPIED_ctr INIT(0);
 #define TICK_ALLOC_HEAP(words)
 
 #define TICK_ALLOC_FUN(g,s)
-#define TICK_ALLOC_THK(g,s)
+#define TICK_ALLOC_UP_THK(g,s)
+#define TICK_ALLOC_SE_THK(g,s)
 #define TICK_ALLOC_CON(g,s)
 #define TICK_ALLOC_TUP(g,s)
 #define TICK_ALLOC_BH(g,s)
@@ -500,6 +533,7 @@ EXTERN unsigned long GC_WORDS_COPIED_ctr INIT(0);
                                
 #define TICK_ENT_CON(n)
 #define TICK_ENT_IND(n)
+#define TICK_ENT_PERM_IND(n)
 #define TICK_ENT_PAP(n)
 #define TICK_ENT_AP_UPD(n)
 #define TICK_ENT_BH()
@@ -513,7 +547,7 @@ EXTERN unsigned long GC_WORDS_COPIED_ctr INIT(0);
 #define TICK_VEC_RETURN(n)
 
 #define TICK_UPDF_OMITTED()
-#define TICK_UPDF_PUSHED()
+#define TICK_UPDF_PUSHED(tgt,inf)
 #define TICK_SEQF_PUSHED()
 #define TICK_CATCHF_PUSHED()
 #define TICK_UPDF_RCC_PUSHED()
@@ -526,7 +560,14 @@ EXTERN unsigned long GC_WORDS_COPIED_ctr INIT(0);
 #define TICK_UPD_PAP_IN_PLACE()
 
 #define TICK_UPD_NEW_IND()
+#define TICK_UPD_NEW_PERM_IND(tgt)
 #define TICK_UPD_OLD_IND()
+#define TICK_UPD_OLD_PERM_IND()
+
+#define TICK_UPD_BH_UPDATABLE()
+#define TICK_UPD_BH_SINGLE_ENTRY()
+#define TICK_UPD_CAF_BH_UPDATABLE()
+#define TICK_UPD_CAF_BH_SINGLE_ENTRY()
 
 #define TICK_GC_SEL_ABANDONED()
 #define TICK_GC_SEL_MINOR()
index 4afbaa6..dd568bd 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: TSO.h,v 1.6 1999/03/16 13:20:10 simonm Exp $
+ * $Id: TSO.h,v 1.7 1999/05/11 16:47:42 keithw Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -27,13 +27,13 @@ typedef struct {
 } StgTSOParInfo;
 #endif /* PAR */
 
-#if defined(TICKY)
+#if defined(TICKY_TICKY)
 typedef struct {
 } StgTSOTickyInfo;
-#else /* !TICKY */
+#else /* !TICKY_TICKY */
 typedef struct {
 } StgTSOTickyInfo;
-#endif /* TICKY */
+#endif /* TICKY_TICKY */
 
 typedef enum {
     tso_state_runnable,
index 08a517a..1cad7b2 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Updates.h,v 1.9 1999/03/18 17:57:20 simonm Exp $
+ * $Id: Updates.h,v 1.10 1999/05/11 16:47:42 keithw Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
  * preferably don't use this macro inline in compiled code.
  */
 
-#define UPD_IND(updclosure, heapptr)                            \
+#ifdef TICKY_TICKY
+# define UPD_IND(updclosure, heapptr) UPD_PERM_IND(updclosure,heapptr)
+#else
+# define UPD_IND(updclosure, heapptr) UPD_REAL_IND(updclosure,heapptr)
+#endif
+
+/* UPD_IND actually does a PERM_IND if TICKY_TICKY is on;
+   if you *really* need an IND use UPD_REAL_IND
+ */
+#define UPD_REAL_IND(updclosure, heapptr)                       \
         AWAKEN_BQ(updclosure);                                  \
        updateWithIndirection((StgClosure *)updclosure,         \
                              (StgClosure *)heapptr);
 
-#ifdef PROFILING
+#if defined(PROFILING) || defined(TICKY_TICKY)
 #define UPD_PERM_IND(updclosure, heapptr)                       \
         AWAKEN_BQ(updclosure);                                  \
        updateWithPermIndirection((StgClosure *)updclosure,     \
@@ -68,7 +77,7 @@ extern DLL_IMPORT_DATA const StgPolyInfoTable Upd_frame_info;
 #define PUSH_UPD_FRAME(target, Sp_offset)                      \
        {                                                       \
                StgUpdateFrame *__frame;                        \
-               TICK_UPDF_PUSHED();                             \
+               TICK_UPDF_PUSHED(target, GET_INFO((StgClosure*)target));                        \
                __frame = stgCast(StgUpdateFrame*,Sp + (Sp_offset)) - 1; \
                SET_INFO(__frame,stgCast(StgInfoTable*,&Upd_frame_info));   \
                __frame->link = Su;                             \
index 0322fef..033fa66 100644 (file)
@@ -170,7 +170,7 @@ AB.myhi: A.myhi B.myhi
 
 HCFLAGS += -DDEBUG=1 
 HCFLAGS += -DDEBUG_EXTRA=1 
-HCFLAGS += -ULAZY_BLACKHOLING 
+HCFLAGS += -ULAZY_BLACKHOLING -DEAGER_BLACKHOLING
 HCFLAGS += -DUSE_MINIINTERPRETER=1 
 HCFLAGS += -DINTERPRETER_ONLY=1 
 HCFLAGS += -DNO_REGS
index c2d309c..abc53cf 100644 (file)
@@ -43,8 +43,10 @@ ifneq "$(way)" ""
 SRC_HC_OPTS += -hisuf $(way_)hi
 endif
 
-Int_HC_OPTS          += -H14m -fno-prune-tydecls -monly-3-regs
-Word_HC_OPTS         += -H12m -monly-3-regs
+# KSW 1998-12: had to increase some of the heap sizes by 2m to 6m for USP
+
+Int_HC_OPTS          += -H20m -fno-prune-tydecls -monly-3-regs
+Word_HC_OPTS         += -H20m -monly-3-regs
 Foreign_HC_OPTS      += -fno-prune-tydecls
 NativeInfo_HC_OPTS   += -fno-prune-tydecls
 Dynamic_HC_OPTS             += $(MAGIC_HSCPP_OPTS)
index 527091d..5d0c5ab 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.13 1999/05/05 10:48:06 sof Exp $
+# $Id: Makefile,v 1.14 1999/05/11 16:47:46 keithw Exp $
 #
 # Makefile for miscellaneous libraries.
 #
@@ -58,10 +58,15 @@ endif
 #
 # Specific flags
 #
-BSD_HC_OPTS          += -I../std/cbits -optc-DNON_POSIX_SOURCE
+
+# KSW 1998-12: had to increase some of the heap sizes by 2m for USP
+
+BSD_HC_OPTS          += -I../std/cbits -H8m -optc-DNON_POSIX_SOURCE
 Socket_HC_OPTS       += -I../std/cbits -optc-DNON_POSIX_SOURCE
-SocketPrim_HC_OPTS   += -I../std/cbits -H10m -optc-DNON_POSIX_SOURCE
+SocketPrim_HC_OPTS   += -I../std/cbits -H12m -optc-DNON_POSIX_SOURCE
 PackedString_HC_OPTS += -H12m
+Native_HC_OPTS       += -H8m
+Pretty_HC_OPTS       += -H8m
 
 #-----------------------------------------------------------------------------
 #      Dependency generation
index 461694b..e8d1216 100644 (file)
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile,v 1.5 1998/12/02 13:26:49 simonm Exp $
+# $Id: Makefile,v 1.6 1999/05/11 16:47:46 keithw Exp $
 #
 # Makefile for POSIX library
 #
@@ -55,6 +55,10 @@ PosixProcPrim_HC_OPTS ='-\#include"cbits/libposix.h"'
 PosixTTY_HC_OPTS      ='-\#include"cbits/libposix.h"' -monly-2-regs
 Posix_HC_OPTS         ='-\#include"cbits/libposix.h"'
 
+# KSW 1998-12: had to increase some of the heap sizes by 2m for USP
+PosixProcPrim_HC_OPTS += -H8m
+PosixFiles_HC_OPTS    += -H8m
+
 # sigh.
 ../misc/PackedString_HC_OPTS += -H8m
 
index 339a6ee..b825259 100644 (file)
@@ -8,5 +8,5 @@
  
 __interface Main 1 where
 __export ! Main main ;
-1 main :: __forall [a] => PrelIOBase.IO a;
+1 main :: __forall [a] => PrelIOBase.IO a;  -- wish this could be __o. KSW 1999-04.
 
index d5ba726..9c2b8cd 100644 (file)
@@ -54,21 +54,26 @@ PrelArrExtra_HC_OPTS     += -monly-2-regs
 Directory_HC_OPTS       += -monly-3-regs 
 Time_HC_OPTS            += -monly-3-regs
 
+# argh, adding USP seems to require extra heap... an extra 2 to 6MB,
+# in fact, on each of these.  (KSW 1998-12)
+
 # Far too much heap is needed to compile PrelNumExtra with -O at the
 # moment, but there you go..
-PrelNumExtra_HC_OPTS     += -H30m -K2m
+PrelNumExtra_HC_OPTS     += -H34m -K2m
 
 PrelPack_HC_OPTS        += -K4m
-PrelBase_HC_OPTS         += -H10m
-PrelRead_HC_OPTS         += -H16m
-PrelTup_HC_OPTS          += -H12m
+PrelBase_HC_OPTS         += -H12m
+PrelRead_HC_OPTS         += -H20m
+PrelTup_HC_OPTS          += -H12m -K2m
 PrelNum_HC_OPTS                 += -H12m -K4m
 PrelArr_HC_OPTS          += -H8m
-PrelHandle_HC_OPTS       += -H14m
-Time_HC_OPTS             += -H18m
+PrelHandle_HC_OPTS       += -H20m
+Time_HC_OPTS             += -H24m -K2m
 Complex_HC_OPTS          += -H10m
 IO_HC_OPTS              += -H12m
 PrelMain_HC_OPTS        += -fno-prune-tydecls # avoids an apparent bug; ToDo
+List_HC_OPTS             += -H8m
+Directory_HC_OPTS        += -H8m
 
 #-----------------------------------------------------------------------------
 #      Dependency generation
index cd7ab02..6d0e84f 100644 (file)
@@ -8,4 +8,5 @@
 __interface PrelException 1 0 where
 __export ! PrelException ioError catch;
 1 ioError :: __forall [a] => PrelIOBase.IOError -> PrelIOBase.IO a ;
-1 catch :: __forall [a] => PrelIOBase.IO a -> (PrelIOBase.IOError -> PrelIOBase.IO a) -> PrelIOBase.IO a ;
+1 catch :: __forall [a] => PrelIOBase.IO a -> (PrelIOBase.IOError -> PrelIOBase.IO a) -> PrelIOBase.IO a ;  -- wish there could be more __o's here.  KSW 1999-04.
+
index 5204230..b0be9ec 100644 (file)
@@ -1,5 +1,5 @@
 ---------------------------------------------------------------------------
---                             GHC.hi
+--                             PrelGHC.hi-boot
 -- 
 --     This hand-written interface file allows you to bring into scope the 
 --     primitive operations and types that GHC knows about.
index 3a44183..4f3189c 100644 (file)
@@ -15,4 +15,3 @@ __export ! PrelPack packCStringzh unpackCStringzh unpackNByteszh unpackAppendCSt
 1 unpackNByteszh :: PrelGHC.Addrzh -> PrelGHC.Intzh -> [PrelBase.Char] ;
 1 unpackAppendCStringzh :: PrelGHC.Addrzh -> [PrelBase.Char] -> [PrelBase.Char] ;
 1 unpackFoldrCStringzh :: __forall [a] => PrelGHC.Addrzh -> (PrelBase.Char -> a -> a) -> a -> a ;
-
index ded6c03..b3101d0 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: ClosureFlags.c,v 1.1 1999/03/15 16:30:27 simonm Exp $
+ * $Id: ClosureFlags.c,v 1.2 1999/05/11 16:47:49 keithw Exp $
  *
  * (c) The GHC Team 1998-1999
  *
@@ -67,6 +67,8 @@ StgWord16 closure_flags[] = {
 /* SEQ_FRAME           */ (     _BTM                            ),
 /* BLACKHOLE           */ (          _NS|              _UPT     ),
 /* BLACKHOLE_BQ                */ (          _NS|         _MUT|_UPT     ),
+/* SE_BLACKHOLE                */ (          _NS|              _UPT     ),
+/* SE_CAF_BLACKHOLE    */ (          _NS|              _UPT     ),
 /* MVAR                        */ (_HNF|     _NS|         _MUT|_UPT     ),
 /* ARR_WORDS           */ (_HNF|     _NS|              _UPT     ),
 /* MUT_ARR_PTRS                */ (_HNF|     _NS|         _MUT|_UPT     ),
index 575a028..66f4a89 100644 (file)
@@ -5,8 +5,8 @@
  * Copyright (c) 1994-1998.
  *
  * $RCSfile: Evaluator.c,v $
- * $Revision: 1.15 $
- * $Date: 1999/04/28 12:59:51 $
+ * $Revision: 1.16 $
+ * $Date: 1999/05/11 16:47:50 $
  * ---------------------------------------------------------------------------*/
 
 #include "Rts.h"
@@ -1276,7 +1276,9 @@ StgThreadReturnCode enter( StgClosure* obj0 )
             goto enterLoop;
         }
     case BLACKHOLE:
+    case SE_BLACKHOLE:
     case CAF_BLACKHOLE:
+    case SE_CAF_BLACKHOLE:
         {
            /*was StgBlackHole* */
             StgBlockingQueue* bh = (StgBlockingQueue*)obj;
@@ -1303,8 +1305,7 @@ StgThreadReturnCode enter( StgClosure* obj0 )
                 xPushWord(payloadWord(ap,i));
             }
             obj = ap->fun;
-#ifndef LAZY_BLACKHOLING
-#error no no no
+#ifdef EAGER_BLACKHOLING
             {
                 /* superfluous - but makes debugging easier */
                 StgBlackHole* bh = stgCast(StgBlackHole*,ap);
@@ -1313,7 +1314,7 @@ StgThreadReturnCode enter( StgClosure* obj0 )
                 IF_DEBUG(gccafs,fprintf(stderr,"Eagerly blackholed AP_UPD %p in evaluator\n",bh));
                 /*printObj(bh); */
             }
-#endif /* LAZY_BLACKHOLING */
+#endif /* EAGER_BLACKHOLING */
             goto enterLoop;
         }
     case PAP:
@@ -1604,11 +1605,13 @@ static inline void PopUpdateFrame( StgClosure* obj )
              printObj(obj);
              fprintf(stderr,"Sp = %p\tSu = %p\n\n", Sp, Su);
              );
-#ifndef LAZY_BLACKHOLING
+#ifdef EAGER_BLACKHOLING
     ASSERT(get_itbl(Su->updatee)->type == BLACKHOLE
+           || get_itbl(Su->updatee)->type == SE_BLACKHOLE
            || get_itbl(Su->updatee)->type == CAF_BLACKHOLE
+           || get_itbl(Su->updatee)->type == SE_CAF_BLACKHOLE
            );
-#endif /* LAZY_BLACKHOLING */
+#endif /* EAGER_BLACKHOLING */
     UPD_IND(Su->updatee,obj);
     Sp = stgCast(StgStackPtr,Su) + sizeofW(StgUpdateFrame);
     Su = Su->link;
index 9bee6b2..f97eeff 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: GC.c,v 1.58 1999/05/04 10:19:14 sof Exp $
+ * $Id: GC.c,v 1.59 1999/05/11 16:47:53 keithw Exp $
  *
  * (c) The GHC Team 1998-1999
  *
@@ -1189,6 +1189,8 @@ loop:
     return copy(q,sizeW_fromITBL(info),step);
 
   case CAF_BLACKHOLE:
+  case SE_CAF_BLACKHOLE:
+  case SE_BLACKHOLE:
   case BLACKHOLE:
     return copyPart(q,BLACKHOLE_sizeW(),sizeofW(StgHeader),step);
 
@@ -1271,6 +1273,8 @@ loop:
        /* aargh - do recursively???? */
       case CAF_UNENTERED:
       case CAF_BLACKHOLE:
+      case SE_CAF_BLACKHOLE:
+      case SE_BLACKHOLE:
       case BLACKHOLE:
       case BLACKHOLE_BQ:
        /* not evaluated yet */
@@ -1722,6 +1726,8 @@ scavenge(step *step)
       break;
 
     case CAF_BLACKHOLE:
+    case SE_CAF_BLACKHOLE:
+    case SE_BLACKHOLE:
     case BLACKHOLE:
        p += BLACKHOLE_sizeW();
        break;
@@ -1919,6 +1925,8 @@ scavenge_one(StgClosure *p)
     }
 
   case CAF_BLACKHOLE:
+  case SE_CAF_BLACKHOLE:
+  case SE_BLACKHOLE:
   case BLACKHOLE:
       break;
 
@@ -2402,6 +2410,8 @@ scavenge_stack(StgPtr p, StgPtr stack_end)
            recordMutable((StgMutClosure *)to);
            continue;
          default:
+            /* will never be SE_{,CAF_}BLACKHOLE, since we
+               don't push an update frame for single-entry thunks.  KSW 1999-01. */
            barf("scavenge_stack: UPDATE_FRAME updatee");
          }
        }
@@ -2734,6 +2744,9 @@ threadLazyBlackHole(StgTSO *tso)
 
       if (bh->header.info != &BLACKHOLE_BQ_info &&
          bh->header.info != &CAF_BLACKHOLE_info) {
+#if (!defined(LAZY_BLACKHOLING)) && defined(DEBUG)
+        fprintf(stderr,"Unexpected lazy BHing required at 0x%04x\n",(int)bh);
+#endif
        SET_INFO(bh,&BLACKHOLE_info);
       }
 
@@ -2857,7 +2870,12 @@ threadSqueezeStack(StgTSO *tso)
        * slower --SDM
        */
 #if 0 /* do it properly... */
-      if (GET_INFO(updatee_bypass) == BLACKHOLE_BQ_info) {
+#  if (!defined(LAZY_BLACKHOLING)) && defined(DEBUG)
+#    error Unimplemented lazy BH warning.  (KSW 1999-01)
+#  endif
+      if (GET_INFO(updatee_bypass) == BLACKHOLE_BQ_info
+         || GET_INFO(updatee_bypass) == CAF_BLACKHOLE_info
+         ) {
        /* Sigh.  It has one.  Don't lose those threads! */
          if (GET_INFO(updatee_keep) == BLACKHOLE_BQ_info) {
          /* Urgh.  Two queues.  Merge them. */
@@ -2882,6 +2900,9 @@ threadSqueezeStack(StgTSO *tso)
 #endif
 
       TICK_UPD_SQUEEZED();
+      /* wasn't there something about update squeezing and ticky to be sorted out?
+       * oh yes: we aren't counting each enter properly in this case.  See the log somewhere.
+       * KSW 1999-04-21 */
       UPD_IND(updatee_bypass, updatee_keep); /* this wakes the threads up */
       
       sp = (P_)frame - 1;      /* sp = stuff to slide */
@@ -2897,6 +2918,9 @@ threadSqueezeStack(StgTSO *tso)
        StgBlockingQueue *bh = (StgBlockingQueue *)frame->updatee;
        if (bh->header.info != &BLACKHOLE_BQ_info &&
            bh->header.info != &CAF_BLACKHOLE_info) {
+#if (!defined(LAZY_BLACKHOLING)) && defined(DEBUG)
+          fprintf(stderr,"Unexpected lazy BHing required at 0x%04x\n",(int)bh);
+#endif
          SET_INFO(bh,&BLACKHOLE_info);
        }
       }
index 0b71aef..34f87e8 100644 (file)
@@ -1,6 +1,6 @@
 
 /* -----------------------------------------------------------------------------
- * $Id: Printer.c,v 1.12 1999/05/04 10:19:17 sof Exp $
+ * $Id: Printer.c,v 1.13 1999/05/11 16:47:54 keithw Exp $
  *
  * Copyright (c) 1994-1999.
  *
@@ -179,6 +179,14 @@ void printClosure( StgClosure *obj )
             fprintf(stderr,")\n"); 
             break;
 
+    case SE_BLACKHOLE:
+            fprintf(stderr,"SE_BH\n"); 
+            break;
+
+    case SE_CAF_BLACKHOLE:
+            fprintf(stderr,"SE_CAF_BH\n"); 
+            break;
+
     case BLACKHOLE:
             fprintf(stderr,"BH\n"); 
             break;
index 8f494cd..52112bc 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsFlags.c,v 1.12 1999/03/25 13:14:07 simonm Exp $
+ * $Id: RtsFlags.c,v 1.13 1999/05/11 16:47:55 keithw Exp $
  *
  * (c) The AQUA Project, Glasgow University, 1994-1997
  * (c) The GHC Team, 1998-1999
@@ -193,8 +193,8 @@ void initRtsFlagsDefaults(void)
 #endif
 
 #ifdef TICKY_TICKY
-    RtsFlags.TickyFlags.showTickyStats = rtsFalse;
-    RtsFlags.TickyFlags.tickyFile      = NULL;
+    RtsFlags.TickyFlags.showTickyStats  = rtsFalse;
+    RtsFlags.TickyFlags.tickyFile       = NULL;
 #endif
 }
 
index e89289c..4256c66 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsFlags.h,v 1.12 1999/03/25 13:14:08 simonm Exp $
+ * $Id: RtsFlags.h,v 1.13 1999/05/11 16:47:56 keithw Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -220,8 +220,6 @@ struct GRAN_FLAGS {
 struct TICKY_FLAGS {
     rtsBool showTickyStats;
     FILE   *tickyFile;
-
-    /* see also: doUpdEntryCounts in AllFlags */
 };
 #endif /* TICKY_TICKY */
 
index a436b81..28bc432 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Sanity.c,v 1.12 1999/03/26 14:55:05 simonm Exp $
+ * $Id: Sanity.c,v 1.13 1999/05/11 16:47:57 keithw Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -233,6 +233,10 @@ checkClosure( StgClosure* p )
     case CAF_UNENTERED:
     case CAF_ENTERED:
     case CAF_BLACKHOLE:
+#ifdef TICKY_TICKY
+    case SE_CAF_BLACKHOLE:
+    case SE_BLACKHOLE:
+#endif
     case BLACKHOLE:
     case BLACKHOLE_BQ:
     case FOREIGN:
index 09aeb15..afd73f8 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Schedule.c,v 1.20 1999/04/27 10:59:31 sewardj Exp $
+ * $Id: Schedule.c,v 1.21 1999/05/11 16:47:57 keithw Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -755,7 +755,7 @@ raiseAsync(StgTSO *tso, StgClosure *exception)
        * handler in this frame.
        */
       ap = (StgAP_UPD *)allocate(sizeofW(StgPAP) + 1);
-      TICK_ALLOC_THK(2,0);
+      TICK_ALLOC_UPD_PAP(2,0);
       SET_HDR(ap,&PAP_info,cf->header.prof.ccs);
              
       ap->n_args = 1;
@@ -779,7 +779,7 @@ raiseAsync(StgTSO *tso, StgClosure *exception)
      * fun field.
      */
     ap = (StgAP_UPD *)allocate(AP_sizeW(words));
-    TICK_ALLOC_THK(words+1,0);
+    TICK_ALLOC_UP_THK(words+1,0);
     
     ASSERT(words >= 0);
     
@@ -826,7 +826,7 @@ raiseAsync(StgTSO *tso, StgClosure *exception)
        
        /* now build o = FUN(catch,ap,handler) */
        o = (StgClosure *)allocate(sizeofW(StgClosure)+2);
-       TICK_ALLOC_THK(2,0);
+       TICK_ALLOC_SE_THK(2,0);
        SET_HDR(o,&catch_info,su->header.prof.ccs /* ToDo */);
        o->payload[0] = (StgClosure *)ap;
        o->payload[1] = cf->handler;
@@ -852,7 +852,7 @@ raiseAsync(StgTSO *tso, StgClosure *exception)
        
        /* now build o = FUN(seq,ap) */
        o = (StgClosure *)allocate(sizeofW(StgClosure)+1);
-       TICK_ALLOC_THK(1,0);
+       TICK_ALLOC_SE_THK(1,0);
        SET_HDR(o,&seq_info,su->header.prof.ccs /* ToDo */);
        payloadCPtr(o,0) = (StgClosure *)ap;
        
index f534104..d981f19 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: StgMiscClosures.hc,v 1.21 1999/05/04 10:19:19 sof Exp $
+ * $Id: StgMiscClosures.hc,v 1.22 1999/05/11 16:47:58 keithw Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -55,16 +55,39 @@ STGFUN(IND_PERM_entry)
     FB_
     /* Don't add INDs to granularity cost */
 
-    /* Dont: TICK_ENT_IND(Node); for ticky-ticky; this ind is here only to help profi
-ling */
+    /* Dont: TICK_ENT_IND(Node); for ticky-ticky; this ind is here only to help profiling */
+
+#if defined(TICKY_TICKY) && !defined(PROFILING)
+    /* TICKY_TICKY && !PROFILING means PERM_IND *replaces* an IND, rather than being extra  */
+    TICK_ENT_PERM_IND(R1.p); /* tick */
+#endif
 
     /* Enter PAP cost centre -- lexical scoping only */
     ENTER_CCS_PAP_CL(R1.cl);
 
+    /* For ticky-ticky, change the perm_ind to a normal ind on first
+     * entry, so the number of ent_perm_inds is the number of *thunks*
+     * entered again, not the number of subsequent entries.
+     *
+     * Since this screws up cost centres, we die if profiling and
+     * ticky_ticky are on at the same time.  KSW 1999-01.
+     */
+
+#ifdef TICKY_TICKY
+#  ifdef PROFILING
+#    error Profiling and ticky-ticky do not mix at present!
+#  endif  /* PROFILING */
+    SET_INFO((StgInd*)R1.p,&IND_info);
+#endif /* TICKY_TICKY */
+
     R1.p = (P_) ((StgInd*)R1.p)->indirectee;
 
     /* Dont: TICK_ENT_VIA_NODE(); for ticky-ticky; as above */
 
+#if defined(TICKY_TICKY) && !defined(PROFILING)
+    TICK_ENT_VIA_NODE();
+#endif
+
     JMP_(*R1.p);
     FE_
 }  
@@ -85,14 +108,24 @@ INFO_TABLE(IND_OLDGEN_PERM_info,IND_OLDGEN_PERM_entry,1,1,IND_OLDGEN_PERM,const,
 STGFUN(IND_OLDGEN_PERM_entry)
 {
     FB_
-    TICK_ENT_IND(Node);        /* tick */
-  
-    /* Dont: TICK_ENT_IND(Node); for ticky-ticky; this ind is here only to help profi
-ling */
+    /* Dont: TICK_ENT_IND(Node); for ticky-ticky; this ind is here only to help profiling */
 
+#if defined(TICKY_TICKY) && !defined(PROFILING)
+    /* TICKY_TICKY && !PROFILING means PERM_IND *replaces* an IND, rather than being extra  */
+    TICK_ENT_PERM_IND(R1.p); /* tick */
+#endif
+  
     /* Enter PAP cost centre -- lexical scoping only */
     ENTER_CCS_PAP_CL(R1.cl);
 
+    /* see comment in IND_PERM */
+#ifdef TICKY_TICKY
+#  ifdef PROFILING
+#    error Profiling and ticky-ticky do not mix at present!
+#  endif  /* PROFILING */
+    SET_INFO((StgInd*)R1.p,&IND_OLDGEN_info);
+#endif /* TICKY_TICKY */
+
     R1.p = (P_) ((StgInd*)R1.p)->indirectee;
     TICK_ENT_VIA_NODE();
     JMP_(*R1.p);
@@ -197,6 +230,30 @@ STGFUN(CAF_BLACKHOLE_entry)
   FE_
 }
 
+#ifdef TICKY_TICKY
+INFO_TABLE(SE_BLACKHOLE_info, SE_BLACKHOLE_entry,0,2,SE_BLACKHOLE,const,EF_,0,0);
+STGFUN(SE_BLACKHOLE_entry)
+{
+  FB_
+    STGCALL1(fflush,stdout);                                           
+    STGCALL3(fprintf,stderr,"SE_BLACKHOLE at %p entered!\n",R1.p);
+    STGCALL1(raiseError, errorHandler);
+    stg_exit(EXIT_FAILURE); /* not executed */
+  FE_
+}
+
+INFO_TABLE(SE_CAF_BLACKHOLE_info, SE_CAF_BLACKHOLE_entry,0,2,SE_CAF_BLACKHOLE,const,EF_,0,0);
+STGFUN(SE_CAF_BLACKHOLE_entry)
+{
+  FB_
+    STGCALL1(fflush,stdout);                                           
+    STGCALL3(fprintf,stderr,"SE_CAF_BLACKHOLE at %p entered!\n",R1.p);
+    STGCALL1(raiseError, errorHandler);
+    stg_exit(EXIT_FAILURE); /* not executed */
+  FE_
+}
+#endif
+
 /* -----------------------------------------------------------------------------
    The code for a BCO returns to the scheduler
    -------------------------------------------------------------------------- */
index 9c9b270..eb0b241 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Storage.h,v 1.8 1999/03/18 17:57:23 simonm Exp $
+ * $Id: Storage.h,v 1.9 1999/05/11 16:47:59 keithw Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -81,16 +81,18 @@ extern StgClosure *MarkRoot(StgClosure *p);
 /* -----------------------------------------------------------------------------
    Generational garbage collection support
 
-   RecordMutable(StgPtr p)       Informs the garbage collector that a
+   recordMutable(StgPtr p)       Informs the garbage collector that a
                                 previously immutable object has
                                 become (permanently) mutable.  Used
                                 by thawArray and similar.
 
-   UpdateWithIndirection(p1,p2)  Updates the object at p1 with an
+   updateWithIndirection(p1,p2)  Updates the object at p1 with an
                                 indirection pointing to p2.  This is
                                 normally called for objects in an old
                                 generation (>0) when they are updated.
 
+   updateWithPermIndirection(p1,p2)  As above but uses a permanent indir.
+
    -------------------------------------------------------------------------- */
 
 static inline void
@@ -138,7 +140,7 @@ updateWithIndirection(StgClosure *p1, StgClosure *p2)
   }
 }
 
-#ifdef PROFILING
+#if defined(TICKY_TICKY) || defined(PROFILING)
 static inline void
 updateWithPermIndirection(StgClosure *p1, StgClosure *p2) 
 {
@@ -148,13 +150,13 @@ updateWithPermIndirection(StgClosure *p1, StgClosure *p2)
   if (bd->gen->no == 0) {
     SET_INFO(p1,&IND_PERM_info);
     ((StgInd *)p1)->indirectee = p2;
-    TICK_UPD_NEW_IND();
+    TICK_UPD_NEW_PERM_IND(p1);
   } else {
     SET_INFO(p1,&IND_OLDGEN_PERM_info);
     ((StgIndOldGen *)p1)->indirectee = p2;
     ((StgIndOldGen *)p1)->mut_link = bd->gen->mut_once_list;
     bd->gen->mut_once_list = (StgMutClosure *)p1;
-    TICK_UPD_OLD_IND();
+    TICK_UPD_OLD_PERM_IND();
   }
 }
 #endif
index af91976..c33fb25 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Ticky.c,v 1.5 1999/03/05 12:43:26 kw217 Exp $
+ * $Id: Ticky.c,v 1.6 1999/05/11 16:47:59 keithw Exp $
  *
  * (c) The AQUA project, Glasgow University, 1992-1997
  * (c) The GHC Team, 1998-1999
@@ -31,7 +31,7 @@ PrintTickyInfo(void)
 {
   unsigned long i;
   unsigned long tot_allocs = /* total number of things allocated */
-       ALLOC_FUN_ctr + ALLOC_THK_ctr + ALLOC_CON_ctr + ALLOC_TUP_ctr +
+       ALLOC_FUN_ctr + ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr + ALLOC_CON_ctr + ALLOC_TUP_ctr +
        ALLOC_TSO_ctr +
 #ifdef PAR
        ALLOC_FMBQ_ctr + ALLOC_FME_ctr + ALLOC_BF_ctr +
@@ -68,7 +68,7 @@ PrintTickyInfo(void)
 
   unsigned long tot_enters =
        ENT_CON_ctr + ENT_FUN_DIRECT_ctr +
-       ENT_IND_ctr + ENT_PAP_ctr + ENT_THK_ctr;
+       ENT_IND_ctr + ENT_PERM_IND_ctr + ENT_PAP_ctr + ENT_THK_ctr;
   unsigned long jump_direct_enters =
        tot_enters - ENT_VIA_NODE_ctr;
   unsigned long bypass_enters =
@@ -85,8 +85,8 @@ PrintTickyInfo(void)
 
   unsigned long tot_updates = UPD_EXISTING_ctr + UPD_SQUEEZED_ctr + pap_updates;
 
-  unsigned long tot_new_updates   = UPD_NEW_IND_ctr;
-  unsigned long tot_old_updates   = UPD_OLD_IND_ctr;
+  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;
   unsigned long tot_gengc_updates = tot_new_updates + tot_old_updates;
 
   FILE *tf = RtsFlags.TickyFlags.tickyFile;
@@ -109,10 +109,14 @@ PrintTickyInfo(void)
       fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(FUN));
 
   fprintf(tf,"\n%7ld (%5.1f%%) thunks",
-       ALLOC_THK_ctr,
-       PC(INTAVG(ALLOC_THK_ctr, tot_allocs)));
-  if (ALLOC_THK_ctr != 0)
+       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%7ld (%5.1f%%) data values",
        ALLOC_CON_ctr,
@@ -190,9 +194,12 @@ PrintTickyInfo(void)
   fprintf(tf,"%7ld (%5.1f%%) partial applications\n",
        ENT_PAP_ctr,
        PC(INTAVG(ENT_PAP_ctr,tot_enters)));
-  fprintf(tf,"%7ld (%5.1f%%) indirections\n",
+  fprintf(tf,"%7ld (%5.1f%%) normal indirections\n",
        ENT_IND_ctr,
        PC(INTAVG(ENT_IND_ctr,tot_enters)));
+  fprintf(tf,"%7ld (%5.1f%%) permanent indirections\n",
+       ENT_PERM_IND_ctr,
+       PC(INTAVG(ENT_PERM_IND_ctr,tot_enters)));
 
   fprintf(tf,"\nRETURNS: %ld\n", tot_returns);
   fprintf(tf,"%7ld (%5.1f%%) from entering a new constructor\n\t\t  [the rest from entering an existing constructor]\n",
@@ -278,6 +285,9 @@ PrintTickyInfo(void)
 
 #define PR_CTR(ctr) \
   do { fprintf(tf,"%7ld " #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,"%7ld " #ctr "\n", ctr); } else { fprintf(tf,"%7ld " msg "\n", ctr); }
 #define PR_HST(hst,i) \
   do { fprintf(tf,"%7ld " #hst "_" #i "\n", hst[i]); } while(0)
 
@@ -293,7 +303,8 @@ PrintTickyInfo(void)
   PR_HST(ALLOC_FUN_hst,2);
   PR_HST(ALLOC_FUN_hst,3);
   PR_HST(ALLOC_FUN_hst,4);
-  PR_CTR(ALLOC_THK_ctr);
+  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);
@@ -393,6 +404,22 @@ PrintTickyInfo(void)
   PR_CTR(ENT_FUN_STD_ctr);
   PR_CTR(ENT_FUN_DIRECT_ctr);
   PR_CTR(ENT_IND_ctr);
+
+/* The counters ENT_PERM_IND and UPD_{NEW,OLD}_PERM_IND are not dumped
+ * at the end of execution unless update squeezing is turned off (+RTS
+ * -Z =RtsFlags.GcFlags.squeezeUpdFrames), as they will be wrong
+ * otherwise.  Why?  Because for each update frame squeezed out, we
+ * count an UPD_NEW_PERM_IND *at GC time* (i.e., too early).  And
+ * further, when we enter the closure that has been updated, we count
+ * the ENT_PERM_IND, but we then enter the PERM_IND that was built for
+ * the next update frame below, and so on down the chain until we
+ * finally reach the value.  Thus we count many new ENT_PERM_INDs too
+ * early.  
+ * 
+ * This of course refers to the -ticky version that uses PERM_INDs to
+ * determine the number of closures entered 0/1/>1.  KSW 1999-04.  */
+  COND_PR_CTR(ENT_PERM_IND_ctr,RtsFlags.GcFlags.squeezeUpdFrames == rtsTrue,"E!NT_PERM_IND_ctr requires +RTS -Z");
+
   PR_CTR(ENT_PAP_ctr);
   PR_CTR(ENT_AP_UPD_ctr);
   PR_CTR(ENT_BH_ctr);
@@ -469,6 +496,11 @@ PrintTickyInfo(void)
   PR_CTR(UPD_PAP_IN_NEW_ctr);
   PR_CTR(UPD_PAP_IN_PLACE_ctr);
 
+  PR_CTR(UPD_BH_UPDATABLE_ctr);
+  PR_CTR(UPD_BH_SINGLE_ENTRY_ctr);
+  PR_CTR(UPD_CAF_BH_UPDATABLE_ctr);
+  PR_CTR(UPD_CAF_BH_SINGLE_ENTRY_ctr);
+
   PR_HST(UPD_CON_IN_NEW_hst,0);
   PR_HST(UPD_CON_IN_NEW_hst,1);
   PR_HST(UPD_CON_IN_NEW_hst,2);
@@ -489,7 +521,11 @@ PrintTickyInfo(void)
   PR_HST(UPD_PAP_IN_NEW_hst,8);
 
   PR_CTR(UPD_NEW_IND_ctr);
+  /* see comment on ENT_PERM_IND_ctr */
+  COND_PR_CTR(UPD_NEW_PERM_IND_ctr,RtsFlags.GcFlags.squeezeUpdFrames == rtsTrue,"U!PD_NEW_PERM_IND_ctr requires +RTS -Z");
   PR_CTR(UPD_OLD_IND_ctr);
+  /* see comment on ENT_PERM_IND_ctr */
+  COND_PR_CTR(UPD_OLD_PERM_IND_ctr,RtsFlags.GcFlags.squeezeUpdFrames == rtsTrue,"U!PD_OLD_PERM_IND_ctr requires +RTS -Z");
 
   PR_CTR(GC_SEL_ABANDONED_ctr);
   PR_CTR(GC_SEL_MINOR_ctr);
index f4aa7eb..b639164 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Updates.hc,v 1.15 1999/04/23 09:47:33 simonm Exp $
+ * $Id: Updates.hc,v 1.16 1999/05/11 16:48:00 keithw Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -9,6 +9,7 @@
 
 #include "Rts.h"
 #include "RtsUtils.h"
+#include "RtsFlags.h"
 #include "HeapStackCheck.h"
 #include "Storage.h"
 #include "ProfRts.h"
@@ -321,7 +322,7 @@ EXTFUN(stg_update_PAP)
        * either the new PAP or Node.
        */
       
-      Updatee = Su->updatee;
+      Updatee = Su->updatee; 
 
 #if defined(PROFILING)
       if (Words != 0) {