Remove CONSTR_STATIC
authorSimon Marlow <marlowsd@gmail.com>
Wed, 9 Nov 2016 09:20:02 +0000 (09:20 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Mon, 14 Nov 2016 14:43:35 +0000 (14:43 +0000)
Summary:
We currently have two info tables for a constructor

* XXX_con_info: the info table for a heap-resident instance of the
  constructor, It has type CONSTR, or one of the specialised types like
  CONSTR_1_0

* XXX_static_info: the info table for a static instance of this
  constructor, which has type CONSTR_STATIC or CONSTR_STATIC_NOCAF.

I'm getting rid of the latter, and using the `con_info` info table for
both static and dynamic constructors.  For rationale and more details
see Note [static constructors] in SMRep.hs.

I also removed these macros: `isSTATIC()`, `ip_STATIC()`,
`closure_STATIC()`, since they relied on the CONSTR/CONSTR_STATIC
distinction, and anyway HEAP_ALLOCED() does the same job.

Test Plan: validate

Reviewers: bgamari, simonpj, austin, gcampax, hvr, niteria, erikd

Subscribers: thomie

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

GHC Trac Issues: #12455

24 files changed:
compiler/cmm/CLabel.hs
compiler/cmm/SMRep.hs
compiler/codeGen/StgCmm.hs
compiler/codeGen/StgCmmClosure.hs
compiler/ghci/RtClosureInspect.hs
docs/rts/rts.tex
includes/rts/storage/ClosureTypes.h
includes/rts/storage/InfoTables.h
rts/CheckUnload.c
rts/ClosureFlags.c
rts/Interpreter.c
rts/LdvProfile.c
rts/Prelude.h
rts/Printer.c
rts/ProfHeap.c
rts/Profiling.c
rts/RetainerProfile.c
rts/StgMiscClosures.cmm
rts/sm/CNF.c
rts/sm/Compact.c
rts/sm/Evac.c
rts/sm/GCAux.c
rts/sm/Sanity.c
rts/sm/Scav.c

index b262371..0b64e3e 100644 (file)
@@ -20,10 +20,8 @@ module CLabel (
         mkEntryLabel,
         mkSlowEntryLabel,
         mkConEntryLabel,
-        mkStaticConEntryLabel,
         mkRednCountsLabel,
         mkConInfoTableLabel,
-        mkStaticInfoTableLabel,
         mkLargeSRTLabel,
         mkApEntryLabel,
         mkApInfoTableLabel,
@@ -33,9 +31,7 @@ module CLabel (
         mkLocalInfoTableLabel,
         mkLocalEntryLabel,
         mkLocalConEntryLabel,
-        mkLocalStaticConEntryLabel,
         mkLocalConInfoTableLabel,
-        mkLocalStaticInfoTableLabel,
         mkLocalClosureTableLabel,
 
         mkReturnPtLabel,
@@ -390,8 +386,6 @@ data IdLabelInfo
 
   | ConEntry            -- ^ Constructor entry point
   | ConInfoTable        -- ^ Corresponding info table
-  | StaticConEntry      -- ^ Static constructor entry point
-  | StaticInfoTable     -- ^ Corresponding info table
 
   | ClosureTable        -- ^ Table of closures for Enum tycons
 
@@ -479,25 +473,17 @@ mkEntryLabel                :: Name -> CafInfo -> CLabel
 mkClosureTableLabel         :: Name -> CafInfo -> CLabel
 mkLocalConInfoTableLabel    :: CafInfo -> Name -> CLabel
 mkLocalConEntryLabel        :: CafInfo -> Name -> CLabel
-mkLocalStaticInfoTableLabel :: CafInfo -> Name -> CLabel
-mkLocalStaticConEntryLabel  :: CafInfo -> Name -> CLabel
 mkConInfoTableLabel         :: Name -> CafInfo -> CLabel
-mkStaticInfoTableLabel      :: Name -> CafInfo -> CLabel
 mkClosureLabel name         c     = IdLabel name c Closure
 mkInfoTableLabel name       c     = IdLabel name c InfoTable
 mkEntryLabel name           c     = IdLabel name c Entry
 mkClosureTableLabel name    c     = IdLabel name c ClosureTable
 mkLocalConInfoTableLabel    c con = IdLabel con c ConInfoTable
 mkLocalConEntryLabel        c con = IdLabel con c ConEntry
-mkLocalStaticInfoTableLabel c con = IdLabel con c StaticInfoTable
-mkLocalStaticConEntryLabel  c con = IdLabel con c StaticConEntry
 mkConInfoTableLabel name    c     = IdLabel name c ConInfoTable
-mkStaticInfoTableLabel name c     = IdLabel name c StaticInfoTable
 
 mkConEntryLabel       :: Name -> CafInfo -> CLabel
-mkStaticConEntryLabel :: Name -> CafInfo -> CLabel
 mkConEntryLabel name        c     = IdLabel name c ConEntry
-mkStaticConEntryLabel name  c     = IdLabel name c StaticConEntry
 
 -- Constructing Cmm Labels
 mkDirty_MUT_VAR_Label, mkSplitMarkerLabel, mkUpdInfoLabel,
@@ -677,7 +663,6 @@ toSlowEntryLbl l = pprPanic "toSlowEntryLbl" (ppr l)
 toEntryLbl :: CLabel -> CLabel
 toEntryLbl (IdLabel n c LocalInfoTable)  = IdLabel n c LocalEntry
 toEntryLbl (IdLabel n c ConInfoTable)    = IdLabel n c ConEntry
-toEntryLbl (IdLabel n c StaticInfoTable) = IdLabel n c StaticConEntry
 toEntryLbl (IdLabel n c _)               = IdLabel n c Entry
 toEntryLbl (CaseLabel n CaseReturnInfo)  = CaseLabel n CaseReturnPt
 toEntryLbl (CmmLabel m str CmmInfo)      = CmmLabel m str CmmEntry
@@ -688,7 +673,6 @@ toInfoLbl :: CLabel -> CLabel
 toInfoLbl (IdLabel n c Entry)          = IdLabel n c InfoTable
 toInfoLbl (IdLabel n c LocalEntry)     = IdLabel n c LocalInfoTable
 toInfoLbl (IdLabel n c ConEntry)       = IdLabel n c ConInfoTable
-toInfoLbl (IdLabel n c StaticConEntry) = IdLabel n c StaticInfoTable
 toInfoLbl (IdLabel n c _)              = IdLabel n c InfoTable
 toInfoLbl (CaseLabel n CaseReturnPt)   = CaseLabel n CaseReturnInfo
 toInfoLbl (CmmLabel m str CmmEntry)    = CmmLabel m str CmmInfo
@@ -944,7 +928,6 @@ idInfoLabelType info =
     LocalInfoTable -> DataLabel
     Closure       -> GcPtrLabel
     ConInfoTable  -> DataLabel
-    StaticInfoTable -> DataLabel
     ClosureTable  -> DataLabel
     RednCounts    -> DataLabel
     _             -> CodeLabel
@@ -1239,8 +1222,6 @@ ppIdFlavor x = pp_cSEP <>
                        RednCounts       -> text "ct"
                        ConEntry         -> text "con_entry"
                        ConInfoTable     -> text "con_info"
-                       StaticConEntry   -> text "static_entry"
-                       StaticInfoTable  -> text "static_info"
                        ClosureTable     -> text "closure_tbl"
                       )
 
index ecd8905..83ddf18 100644 (file)
@@ -177,6 +177,7 @@ data SMRep
 
 -- | True <=> This is a static closure.  Affects how we garbage-collect it.
 -- Static closure have an extra static link field at the end.
+-- Constructors do not have a static variant; see Note [static constructors]
 type IsStatic = Bool
 
 -- From an SMRep you can get to the closure type defined in
@@ -287,10 +288,10 @@ isFunRep (HeapRep _ _ _ Fun{}) = True
 isFunRep _                     = False
 
 isStaticNoCafCon :: SMRep -> Bool
--- This should line up exactly with CONSTR_NOCAF_STATIC above
+-- This should line up exactly with CONSTR_NOCAF below
 -- See Note [Static NoCaf constructors]
-isStaticNoCafCon (HeapRep True 0 _ Constr{}) = True
-isStaticNoCafCon _                           = False
+isStaticNoCafCon (HeapRep _ 0 _ Constr{}) = True
+isStaticNoCafCon _                        = False
 
 
 -----------------------------------------------------------------------------
@@ -428,12 +429,15 @@ rtsClosureType rep
     = case rep of
       RTSRep ty _ -> ty
 
-      HeapRep False 1 0 Constr{} -> CONSTR_1_0
-      HeapRep False 0 1 Constr{} -> CONSTR_0_1
-      HeapRep False 2 0 Constr{} -> CONSTR_2_0
-      HeapRep False 1 1 Constr{} -> CONSTR_1_1
-      HeapRep False 0 2 Constr{} -> CONSTR_0_2
-      HeapRep False _ _ Constr{} -> CONSTR
+      -- See Note [static constructors]
+      HeapRep _     1 0 Constr{} -> CONSTR_1_0
+      HeapRep _     0 1 Constr{} -> CONSTR_0_1
+      HeapRep _     2 0 Constr{} -> CONSTR_2_0
+      HeapRep _     1 1 Constr{} -> CONSTR_1_1
+      HeapRep _     0 2 Constr{} -> CONSTR_0_2
+      HeapRep _     0 _ Constr{} -> CONSTR_NOCAF
+           -- See Note [Static NoCaf constructors]
+      HeapRep _     _ _ Constr{} -> CONSTR
 
       HeapRep False 1 0 Fun{} -> FUN_1_0
       HeapRep False 0 1 Fun{} -> FUN_0_1
@@ -451,10 +455,6 @@ rtsClosureType rep
 
       HeapRep False _ _ ThunkSelector{} ->  THUNK_SELECTOR
 
-      -- Approximation: we use the CONSTR_NOCAF_STATIC type for static
-      -- constructors -- that have no pointer words only.
-      HeapRep True 0 _ Constr{} -> CONSTR_NOCAF_STATIC  -- See isStaticNoCafCon below
-      HeapRep True _ _ Constr{} -> CONSTR_STATIC
       HeapRep True _ _ Fun{}    -> FUN_STATIC
       HeapRep True _ _ Thunk{}  -> THUNK_STATIC
 
@@ -472,6 +472,34 @@ aRG_GEN     = ARG_GEN
 aRG_GEN_BIG = ARG_GEN_BIG
 
 {-
+Note [static constructors]
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+We used to have a CONSTR_STATIC closure type, and each constructor had
+two info tables: one with CONSTR (or CONSTR_1_0 etc.), and one with
+CONSTR_STATIC.
+
+This distinction was removed, because when copying a data structure
+into a compact region, we must copy static constructors into the
+compact region too.  If we didn't do this, we would need to track the
+references from the compact region out to the static constructors,
+because they might (indirectly) refer to CAFs.
+
+Since static constructors will be copied to the heap, if we wanted to
+use different info tables for static and dynamic constructors, we
+would have to switch the info pointer when copying the constructor
+into the compact region, which means we would need an extra field of
+the static info table to point to the dynamic one.
+
+However, since the distinction between static and dynamic closure
+types is never actually needed (other than for assertions), we can
+just drop the distinction and use the same info table for both.
+
+The GC *does* need to distinguish between static and dynamic closures,
+but it does this using the HEAP_ALLOCED() macro which checks whether
+the address of the closure resides within the dynamic heap.
+HEAP_ALLOCED() doesn't read the closure's info table.
+
 Note [Static NoCaf constructors]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 If we know that a top-level binding 'x' is not Caffy (ie no CAFs are
index 28ca97d..aac556d 100644 (file)
@@ -226,41 +226,31 @@ cgDataCon data_con
 
             nonptr_wds   = tot_wds - ptr_wds
 
-            sta_info_tbl = mkDataConInfoTable dflags data_con True  ptr_wds nonptr_wds
-            dyn_info_tbl = mkDataConInfoTable dflags data_con False ptr_wds nonptr_wds
-
-            emit_info info_tbl ticky_code
-                = emitClosureAndInfoTable info_tbl NativeDirectCall []
-                             $ mk_code ticky_code
-
-            mk_code ticky_code
-              = -- NB: the closure pointer is assumed *untagged* on
-                -- entry to a constructor.  If the pointer is tagged,
-                -- then we should not be entering it.  This assumption
-                -- is used in ldvEnter and when tagging the pointer to
-                -- return it.
-                -- NB 2: We don't set CC when entering data (WDP 94/06)
-                do { _ <- ticky_code
-                   ; ldvEnter (CmmReg nodeReg)
-                   ; tickyReturnOldCon (length arg_reps)
-                   ; void $ emitReturn [cmmOffsetB dflags (CmmReg nodeReg) (tagForCon dflags data_con)]
-                   }
-                        -- The case continuation code expects a tagged pointer
+            dyn_info_tbl =
+              mkDataConInfoTable dflags data_con False ptr_wds nonptr_wds
 
             -- We're generating info tables, so we don't know and care about
             -- what the actual arguments are. Using () here as the place holder.
             arg_reps :: [NonVoid PrimRep]
-            arg_reps = [NonVoid (typePrimRep rep_ty) | ty <- dataConRepArgTys data_con
-                                                     , rep_ty <- repTypeArgs ty
-                                                     , not (isVoidTy rep_ty)]
-
-            -- Dynamic closure code for non-nullary constructors only
-        ; when (not (isNullaryRepDataCon data_con))
-                (emit_info dyn_info_tbl tickyEnterDynCon)
-
-                -- Dynamic-Closure first, to reduce forward references
-        ; emit_info sta_info_tbl tickyEnterStaticCon }
-
+            arg_reps = [ NonVoid (typePrimRep rep_ty)
+                       | ty <- dataConRepArgTys data_con
+                       , rep_ty <- repTypeArgs ty
+                       , not (isVoidTy rep_ty)]
+
+        ; emitClosureAndInfoTable dyn_info_tbl NativeDirectCall [] $
+            -- NB: the closure pointer is assumed *untagged* on
+            -- entry to a constructor.  If the pointer is tagged,
+            -- then we should not be entering it.  This assumption
+            -- is used in ldvEnter and when tagging the pointer to
+            -- return it.
+            -- NB 2: We don't set CC when entering data (WDP 94/06)
+            do { tickyEnterDynCon
+               ; ldvEnter (CmmReg nodeReg)
+               ; tickyReturnOldCon (length arg_reps)
+               ; void $ emitReturn [cmmOffsetB dflags (CmmReg nodeReg) (tagForCon dflags data_con)]
+               }
+                    -- The case continuation code expects a tagged pointer
+        }
 
 ---------------------------------------------------------------
 --      Stuff to support splitting
index 23b803c..0ce119b 100644 (file)
@@ -1040,12 +1040,8 @@ mkDataConInfoTable dflags data_con is_static ptr_wds nonptr_wds
                 , cit_srt  = NoC_SRT }
  where
    name = dataConName data_con
-
-   info_lbl | is_static = mkStaticInfoTableLabel name NoCafRefs
-            | otherwise = mkConInfoTableLabel    name NoCafRefs
-
+   info_lbl = mkConInfoTableLabel name NoCafRefs
    sm_rep = mkHeapRep dflags is_static ptr_wds nonptr_wds cl_type
-
    cl_type = Constr (dataConTagZ data_con) (dataConIdentity data_con)
 
    prof | not (gopt Opt_SccProfilingOn dflags) = NoProfilingInfo
@@ -1074,16 +1070,10 @@ indStaticInfoTable
 staticClosureNeedsLink :: Bool -> CmmInfoTable -> Bool
 -- A static closure needs a link field to aid the GC when traversing
 -- the static closure graph.  But it only needs such a field if either
---         a) it has an SRT
+--        a) it has an SRT
 --        b) it's a constructor with one or more pointer fields
 -- In case (b), the constructor's fields themselves play the role
 -- of the SRT.
---
--- At this point, the cit_srt field has not been calculated (that
--- happens right at the end of the Cmm pipeline), but we do have the
--- VarSet of CAFs that CoreToStg attached, and if that is empty there
--- will definitely not be an SRT.
---
 staticClosureNeedsLink has_srt CmmInfoTable{ cit_rep = smrep }
   | isConRep smrep         = not (isStaticNoCafCon smrep)
   | otherwise              = has_srt -- needsSRT (cit_srt info_tbl)
index eff2660..815e5e6 100644 (file)
@@ -191,7 +191,7 @@ getClosureData dflags a =
 
 readCType :: Integral a => a -> ClosureType
 readCType i
- | i >= CONSTR && i <= CONSTR_NOCAF_STATIC = Constr
+ | i >= CONSTR && i <= CONSTR_NOCAF        = Constr
  | i >= FUN    && i <= FUN_STATIC          = Fun
  | i >= THUNK  && i < THUNK_SELECTOR       = Thunk i'
  | i == THUNK_SELECTOR                     = ThunkSelector
index 809705e..191d65d 100644 (file)
@@ -1786,8 +1786,6 @@ SRT pointer.
 
 \begin{itemize}
 
-\item @isSTATIC@ is true for any statically allocated closure.
-
 \item @isMUTABLE@ is true for objects with mutable pointer fields:
   @MUT_ARR@s, @MUTVAR@s, @MVAR@s and @IVAR@s.
 
index f5e96e7..234e00b 100644 (file)
  */
 
 /* Object tag 0 raises an internal error */
-#define INVALID_OBJECT          0
-#define CONSTR                  1
-#define CONSTR_1_0              2
-#define CONSTR_0_1              3
-#define CONSTR_2_0              4
-#define CONSTR_1_1              5
-#define CONSTR_0_2              6
-#define CONSTR_STATIC           7
-#define CONSTR_NOCAF_STATIC     8
-#define FUN                     9
-#define FUN_1_0                 10
-#define FUN_0_1                 11
-#define FUN_2_0                 12
-#define FUN_1_1                 13
-#define FUN_0_2                 14
-#define FUN_STATIC              15
-#define THUNK                   16
-#define THUNK_1_0               17
-#define THUNK_0_1               18
-#define THUNK_2_0               19
-#define THUNK_1_1               20
-#define THUNK_0_2               21
-#define THUNK_STATIC            22
-#define THUNK_SELECTOR          23
-#define BCO                     24
-#define AP                      25
-#define PAP                     26
-#define AP_STACK                27
-#define IND                     28
-#define IND_STATIC              29
-#define RET_BCO                 30
-#define RET_SMALL               31
-#define RET_BIG                 32
-#define RET_FUN                 33
-#define UPDATE_FRAME            34
-#define CATCH_FRAME             35
-#define UNDERFLOW_FRAME         36
-#define STOP_FRAME              37
-#define BLOCKING_QUEUE          38
-#define BLACKHOLE               39
-#define MVAR_CLEAN              40
-#define MVAR_DIRTY              41
-#define TVAR                    42
-#define ARR_WORDS               43
-#define MUT_ARR_PTRS_CLEAN      44
-#define MUT_ARR_PTRS_DIRTY      45
-#define MUT_ARR_PTRS_FROZEN0    46
-#define MUT_ARR_PTRS_FROZEN     47
-#define MUT_VAR_CLEAN           48
-#define MUT_VAR_DIRTY           49
-#define WEAK                    50
-#define PRIM                    51
-#define MUT_PRIM                52
-#define TSO                     53
-#define STACK                   54
-#define TREC_CHUNK              55
-#define ATOMICALLY_FRAME        56
-#define CATCH_RETRY_FRAME       57
-#define CATCH_STM_FRAME         58
-#define WHITEHOLE               59
-#define SMALL_MUT_ARR_PTRS_CLEAN      60
-#define SMALL_MUT_ARR_PTRS_DIRTY      61
-#define SMALL_MUT_ARR_PTRS_FROZEN0    62
-#define SMALL_MUT_ARR_PTRS_FROZEN     63
-#define COMPACT_NFDATA          64
-#define N_CLOSURE_TYPES         65
+#define INVALID_OBJECT                0
+#define CONSTR                        1
+#define CONSTR_1_0                    2
+#define CONSTR_0_1                    3
+#define CONSTR_2_0                    4
+#define CONSTR_1_1                    5
+#define CONSTR_0_2                    6
+#define CONSTR_NOCAF                  7
+#define FUN                           8
+#define FUN_1_0                       9
+#define FUN_0_1                       10
+#define FUN_2_0                       11
+#define FUN_1_1                       12
+#define FUN_0_2                       13
+#define FUN_STATIC                    14
+#define THUNK                         15
+#define THUNK_1_0                     16
+#define THUNK_0_1                     17
+#define THUNK_2_0                     18
+#define THUNK_1_1                     19
+#define THUNK_0_2                     20
+#define THUNK_STATIC                  21
+#define THUNK_SELECTOR                22
+#define BCO                           23
+#define AP                            24
+#define PAP                           25
+#define AP_STACK                      26
+#define IND                           27
+#define IND_STATIC                    28
+#define RET_BCO                       29
+#define RET_SMALL                     30
+#define RET_BIG                       31
+#define RET_FUN                       32
+#define UPDATE_FRAME                  33
+#define CATCH_FRAME                   34
+#define UNDERFLOW_FRAME               35
+#define STOP_FRAME                    36
+#define BLOCKING_QUEUE                37
+#define BLACKHOLE                     38
+#define MVAR_CLEAN                    39
+#define MVAR_DIRTY                    40
+#define TVAR                          41
+#define ARR_WORDS                     42
+#define MUT_ARR_PTRS_CLEAN            43
+#define MUT_ARR_PTRS_DIRTY            44
+#define MUT_ARR_PTRS_FROZEN0          45
+#define MUT_ARR_PTRS_FROZEN           46
+#define MUT_VAR_CLEAN                 47
+#define MUT_VAR_DIRTY                 48
+#define WEAK                          49
+#define PRIM                          50
+#define MUT_PRIM                      51
+#define TSO                           52
+#define STACK                         53
+#define TREC_CHUNK                    54
+#define ATOMICALLY_FRAME              55
+#define CATCH_RETRY_FRAME             56
+#define CATCH_STM_FRAME               57
+#define WHITEHOLE                     58
+#define SMALL_MUT_ARR_PTRS_CLEAN      59
+#define SMALL_MUT_ARR_PTRS_DIRTY      60
+#define SMALL_MUT_ARR_PTRS_FROZEN0    61
+#define SMALL_MUT_ARR_PTRS_FROZEN     62
+#define COMPACT_NFDATA                63
+#define N_CLOSURE_TYPES               64
 
 #endif /* RTS_STORAGE_CLOSURETYPES_H */
index bb1bac0..87d0410 100644 (file)
@@ -57,14 +57,12 @@ typedef struct {
 #define _HNF (1<<0)  /* head normal form?    */
 #define _BTM (1<<1)  /* uses info->layout.bitmap */
 #define _NS  (1<<2)  /* non-sparkable        */
-#define _STA (1<<3)  /* static?              */
-#define _THU (1<<4)  /* thunk?               */
-#define _MUT (1<<5)  /* mutable?             */
-#define _UPT (1<<6)  /* unpointed?           */
-#define _SRT (1<<7)  /* has an SRT?          */
-#define _IND (1<<8)  /* is an indirection?   */
-
-#define isSTATIC(flags)    ((flags) &_STA)
+#define _THU (1<<3)  /* thunk?               */
+#define _MUT (1<<4)  /* mutable?             */
+#define _UPT (1<<5)  /* unpointed?           */
+#define _SRT (1<<6)  /* has an SRT?          */
+#define _IND (1<<7)  /* is an indirection?   */
+
 #define isMUTABLE(flags)   ((flags) &_MUT)
 #define isBITMAP(flags)    ((flags) &_BTM)
 #define isTHUNK(flags)     ((flags) &_THU)
@@ -80,7 +78,6 @@ extern StgWord16 closure_flags[];
 #define closure_BITMAP(c)       (  closureFlags(c) & _BTM)
 #define closure_NON_SPARK(c)    ( (closureFlags(c) & _NS))
 #define closure_SHOULD_SPARK(c) (!(closureFlags(c) & _NS))
-#define closure_STATIC(c)       (  closureFlags(c) & _STA)
 #define closure_THUNK(c)        (  closureFlags(c) & _THU)
 #define closure_MUTABLE(c)      (  closureFlags(c) & _MUT)
 #define closure_UNPOINTED(c)    (  closureFlags(c) & _UPT)
@@ -93,7 +90,6 @@ extern StgWord16 closure_flags[];
 #define ip_HNF(ip)               (  ipFlags(ip) & _HNF)
 #define ip_BITMAP(ip)            (  ipFlags(ip) & _BTM)
 #define ip_SHOULD_SPARK(ip)      (!(ipFlags(ip) & _NS))
-#define ip_STATIC(ip)            (  ipFlags(ip) & _STA)
 #define ip_THUNK(ip)             (  ipFlags(ip) & _THU)
 #define ip_MUTABLE(ip)           (  ipFlags(ip) & _MUT)
 #define ip_UNPOINTED(ip)         (  ipFlags(ip) & _UPT)
index d303315..03e4e22 100644 (file)
@@ -122,13 +122,14 @@ static void searchHeapBlocks (HashTable *addrs, bdescr *bd)
                 size = sizeofW(StgThunkHeader) + 1;
                 break;
 
-            case CONSTR:
             case FUN:
             case FUN_1_0:
             case FUN_0_1:
             case FUN_1_1:
             case FUN_0_2:
             case FUN_2_0:
+            case CONSTR:
+            case CONSTR_NOCAF:
             case CONSTR_1_0:
             case CONSTR_0_1:
             case CONSTR_1_1:
index b235910..9bf3015 100644 (file)
@@ -18,76 +18,75 @@ StgWord16 closure_flags[] = {
  *  to thunks.)
  */
 
-/*                              0    1    2    3    4   5   6   7     8 */
-/*                            HNF  BTM   NS  STA  THU MUT UPT SRT   IND */
+/*                            0    1    2    4   5    6   7     8 */
+/*                          HNF  BTM   NS  THU MUT  UPT SRT   IND */
 
- [INVALID_OBJECT]       =  ( 0                                           ),
- [CONSTR]               =  (_HNF|     _NS                                ),
- [CONSTR_1_0]           =  (_HNF|     _NS                                ),
- [CONSTR_0_1]           =  (_HNF|     _NS                                ),
- [CONSTR_2_0]           =  (_HNF|     _NS                                ),
- [CONSTR_1_1]           =  (_HNF|     _NS                                ),
- [CONSTR_0_2]           =  (_HNF|     _NS                                ),
- [CONSTR_STATIC]        =  (_HNF|     _NS|_STA                           ),
- [CONSTR_NOCAF_STATIC]  =  (_HNF|     _NS|_STA                           ),
- [FUN]                  =  (_HNF|     _NS|                  _SRT         ),
- [FUN_1_0]              =  (_HNF|     _NS|                  _SRT         ),
- [FUN_0_1]              =  (_HNF|     _NS|                  _SRT         ),
- [FUN_2_0]              =  (_HNF|     _NS|                  _SRT         ),
- [FUN_1_1]              =  (_HNF|     _NS|                  _SRT         ),
- [FUN_0_2]              =  (_HNF|     _NS|                  _SRT         ),
- [FUN_STATIC]           =  (_HNF|     _NS|_STA|             _SRT         ),
- [THUNK]                =  (                   _THU|        _SRT         ),
- [THUNK_1_0]            =  (                   _THU|        _SRT         ),
- [THUNK_0_1]            =  (                   _THU|        _SRT         ),
- [THUNK_2_0]            =  (                   _THU|        _SRT         ),
- [THUNK_1_1]            =  (                   _THU|        _SRT         ),
- [THUNK_0_2]            =  (                   _THU|        _SRT         ),
- [THUNK_STATIC]         =  (              _STA|_THU|        _SRT         ),
- [THUNK_SELECTOR]       =  (                   _THU|        _SRT         ),
- [BCO]                  =  (_HNF|     _NS                                ),
- [AP]                   =  (                   _THU                      ),
- [PAP]                  =  (_HNF|     _NS                                ),
- [AP_STACK]             =  (                   _THU                      ),
- [IND]                  =  (          _NS|                        _IND ),
- [IND_STATIC]           =  (          _NS|_STA|                   _IND ),
- [RET_BCO]              =  ( 0                                         ),
- [RET_SMALL]            =  (     _BTM|                       _SRT      ),
- [RET_BIG]              =  (                                 _SRT      ),
- [RET_FUN]              =  ( 0                                         ),
- [UPDATE_FRAME]         =  (     _BTM                                  ),
- [CATCH_FRAME]          =  (     _BTM                                  ),
- [UNDERFLOW_FRAME]      =  (     _BTM                                  ),
- [STOP_FRAME]           =  (     _BTM                                  ),
- [BLACKHOLE]            =  (          _NS|              _UPT           ),
- [BLOCKING_QUEUE]       =  (          _NS|         _MUT|_UPT           ),
- [MVAR_CLEAN]           =  (_HNF|     _NS|         _MUT|_UPT           ),
- [MVAR_DIRTY]           =  (_HNF|     _NS|         _MUT|_UPT           ),
- [TVAR]                 =  (_HNF|     _NS|         _MUT|_UPT           ),
- [ARR_WORDS]            =  (_HNF|     _NS|              _UPT           ),
- [MUT_ARR_PTRS_CLEAN]   =  (_HNF|     _NS|         _MUT|_UPT           ),
- [MUT_ARR_PTRS_DIRTY]   =  (_HNF|     _NS|         _MUT|_UPT           ),
- [MUT_ARR_PTRS_FROZEN0] =  (_HNF|     _NS|         _MUT|_UPT           ),
- [MUT_ARR_PTRS_FROZEN]  =  (_HNF|     _NS|              _UPT           ),
- [MUT_VAR_CLEAN]        =  (_HNF|     _NS|         _MUT|_UPT           ),
- [MUT_VAR_DIRTY]        =  (_HNF|     _NS|         _MUT|_UPT           ),
- [WEAK]                 =  (_HNF|     _NS|              _UPT           ),
- [PRIM]                 =  (_HNF|     _NS|              _UPT           ),
- [MUT_PRIM]             =  (_HNF|     _NS|         _MUT|_UPT           ),
- [TSO]                  =  (_HNF|     _NS|         _MUT|_UPT           ),
- [STACK]                =  (_HNF|     _NS|         _MUT|_UPT           ),
- [TREC_CHUNK]           =  (          _NS|         _MUT|_UPT           ),
- [ATOMICALLY_FRAME]     =  (     _BTM                                  ),
- [CATCH_RETRY_FRAME]    =  (     _BTM                                  ),
- [CATCH_STM_FRAME]      =  (     _BTM                                  ),
- [WHITEHOLE]            =  ( 0                                         ),
- [SMALL_MUT_ARR_PTRS_CLEAN]   =  (_HNF|     _NS|         _MUT|_UPT           ),
- [SMALL_MUT_ARR_PTRS_DIRTY]   =  (_HNF|     _NS|         _MUT|_UPT           ),
- [SMALL_MUT_ARR_PTRS_FROZEN0] =  (_HNF|     _NS|         _MUT|_UPT           ),
- [SMALL_MUT_ARR_PTRS_FROZEN]  =  (_HNF|     _NS|              _UPT           ),
+ [INVALID_OBJECT]       =  ( 0                                    ),
+ [CONSTR]               =  (_HNF|     _NS                         ),
+ [CONSTR_1_0]           =  (_HNF|     _NS                         ),
+ [CONSTR_0_1]           =  (_HNF|     _NS                         ),
+ [CONSTR_2_0]           =  (_HNF|     _NS                         ),
+ [CONSTR_1_1]           =  (_HNF|     _NS                         ),
+ [CONSTR_0_2]           =  (_HNF|     _NS                         ),
+ [CONSTR_NOCAF]         =  (_HNF|     _NS                         ),
+ [FUN]                  =  (_HNF|     _NS|             _SRT       ),
+ [FUN_1_0]              =  (_HNF|     _NS|             _SRT       ),
+ [FUN_0_1]              =  (_HNF|     _NS|             _SRT       ),
+ [FUN_2_0]              =  (_HNF|     _NS|             _SRT       ),
+ [FUN_1_1]              =  (_HNF|     _NS|             _SRT       ),
+ [FUN_0_2]              =  (_HNF|     _NS|             _SRT       ),
+ [FUN_STATIC]           =  (_HNF|     _NS|             _SRT       ),
+ [THUNK]                =  (              _THU|        _SRT       ),
+ [THUNK_1_0]            =  (              _THU|        _SRT       ),
+ [THUNK_0_1]            =  (              _THU|        _SRT       ),
+ [THUNK_2_0]            =  (              _THU|        _SRT       ),
+ [THUNK_1_1]            =  (              _THU|        _SRT       ),
+ [THUNK_0_2]            =  (              _THU|        _SRT       ),
+ [THUNK_STATIC]         =  (              _THU|        _SRT       ),
+ [THUNK_SELECTOR]       =  (              _THU|        _SRT       ),
+ [BCO]                  =  (_HNF|     _NS                         ),
+ [AP]                   =  (              _THU                    ),
+ [PAP]                  =  (_HNF|     _NS                         ),
+ [AP_STACK]             =  (              _THU                    ),
+ [IND]                  =  (          _NS|                   _IND ),
+ [IND_STATIC]           =  (          _NS|                   _IND ),
+ [RET_BCO]              =  ( 0                                    ),
+ [RET_SMALL]            =  (     _BTM|                  _SRT      ),
+ [RET_BIG]              =  (                            _SRT      ),
+ [RET_FUN]              =  ( 0                                    ),
+ [UPDATE_FRAME]         =  (     _BTM                             ),
+ [CATCH_FRAME]          =  (     _BTM                             ),
+ [UNDERFLOW_FRAME]      =  (     _BTM                             ),
+ [STOP_FRAME]           =  (     _BTM                             ),
+ [BLACKHOLE]            =  (          _NS|         _UPT           ),
+ [BLOCKING_QUEUE]       =  (          _NS|    _MUT|_UPT           ),
+ [MVAR_CLEAN]           =  (_HNF|     _NS|    _MUT|_UPT           ),
+ [MVAR_DIRTY]           =  (_HNF|     _NS|    _MUT|_UPT           ),
+ [TVAR]                 =  (_HNF|     _NS|    _MUT|_UPT           ),
+ [ARR_WORDS]            =  (_HNF|     _NS|         _UPT           ),
+ [MUT_ARR_PTRS_CLEAN]   =  (_HNF|     _NS|    _MUT|_UPT           ),
+ [MUT_ARR_PTRS_DIRTY]   =  (_HNF|     _NS|    _MUT|_UPT           ),
+ [MUT_ARR_PTRS_FROZEN0] =  (_HNF|     _NS|    _MUT|_UPT           ),
+ [MUT_ARR_PTRS_FROZEN]  =  (_HNF|     _NS|         _UPT           ),
+ [MUT_VAR_CLEAN]        =  (_HNF|     _NS|    _MUT|_UPT           ),
+ [MUT_VAR_DIRTY]        =  (_HNF|     _NS|    _MUT|_UPT           ),
+ [WEAK]                 =  (_HNF|     _NS|         _UPT           ),
+ [PRIM]                 =  (_HNF|     _NS|         _UPT           ),
+ [MUT_PRIM]             =  (_HNF|     _NS|    _MUT|_UPT           ),
+ [TSO]                  =  (_HNF|     _NS|    _MUT|_UPT           ),
+ [STACK]                =  (_HNF|     _NS|    _MUT|_UPT           ),
+ [TREC_CHUNK]           =  (          _NS|    _MUT|_UPT           ),
+ [ATOMICALLY_FRAME]     =  (     _BTM                             ),
+ [CATCH_RETRY_FRAME]    =  (     _BTM                             ),
+ [CATCH_STM_FRAME]      =  (     _BTM                             ),
+ [WHITEHOLE]            =  ( 0                                    ),
+ [SMALL_MUT_ARR_PTRS_CLEAN]   =  (_HNF|     _NS|     _MUT|_UPT           ),
+ [SMALL_MUT_ARR_PTRS_DIRTY]   =  (_HNF|     _NS|     _MUT|_UPT           ),
+ [SMALL_MUT_ARR_PTRS_FROZEN0] =  (_HNF|     _NS|     _MUT|_UPT           ),
+ [SMALL_MUT_ARR_PTRS_FROZEN]  =  (_HNF|     _NS|          _UPT           ),
  [COMPACT_NFDATA]       =  (_HNF|     _NS                              ),
 };
 
-#if N_CLOSURE_TYPES != 65
+#if N_CLOSURE_TYPES != 64
 #error Closure types changed: update ClosureFlags.c!
 #endif
index f88e474..5e796cd 100644 (file)
@@ -342,8 +342,7 @@ eval_obj:
     case CONSTR_2_0:
     case CONSTR_1_1:
     case CONSTR_0_2:
-    case CONSTR_STATIC:
-    case CONSTR_NOCAF_STATIC:
+    case CONSTR_NOCAF:
     case FUN:
     case FUN_1_0:
     case FUN_0_1:
index 26ead95..38a3563 100644 (file)
@@ -128,10 +128,9 @@ processHeapClosureForDead( const StgClosure *c )
         */
         // static objects
     case IND_STATIC:
-    case CONSTR_STATIC:
     case FUN_STATIC:
     case THUNK_STATIC:
-    case CONSTR_NOCAF_STATIC:
+    case CONSTR_NOCAF:
         // stack objects
     case UPDATE_FRAME:
     case CATCH_FRAME:
index 58de230..16881eb 100644 (file)
@@ -53,22 +53,6 @@ PRELUDE_CLOSURE(base_GHCziConcziSignal_runHandlersPtr_closure);
 
 PRELUDE_CLOSURE(base_GHCziTopHandler_flushStdHandles_closure);
 
-PRELUDE_INFO(ghczmprim_GHCziTypes_Czh_static_info);
-PRELUDE_INFO(ghczmprim_GHCziTypes_Izh_static_info);
-PRELUDE_INFO(ghczmprim_GHCziTypes_Fzh_static_info);
-PRELUDE_INFO(ghczmprim_GHCziTypes_Dzh_static_info);
-PRELUDE_INFO(base_Addr_Azh_static_info);
-PRELUDE_INFO(base_GHCziPtr_Ptr_static_info);
-PRELUDE_INFO(base_GHCziPtr_FunPtr_static_info);
-PRELUDE_INFO(base_GHCziInt_I8zh_static_info);
-PRELUDE_INFO(base_GHCziInt_I16zh_static_info);
-PRELUDE_INFO(base_GHCziInt_I32zh_static_info);
-PRELUDE_INFO(base_GHCziInt_I64zh_static_info);
-PRELUDE_INFO(ghczmprim_GHCziTypes_Wzh_static_info);
-PRELUDE_INFO(base_GHCziWord_W8zh_static_info);
-PRELUDE_INFO(base_GHCziWord_W16zh_static_info);
-PRELUDE_INFO(base_GHCziWord_W32zh_static_info);
-PRELUDE_INFO(base_GHCziWord_W64zh_static_info);
 PRELUDE_INFO(ghczmprim_GHCziTypes_Czh_con_info);
 PRELUDE_INFO(ghczmprim_GHCziTypes_Izh_con_info);
 PRELUDE_INFO(ghczmprim_GHCziTypes_Fzh_con_info);
@@ -85,7 +69,6 @@ PRELUDE_INFO(base_GHCziWord_W8zh_con_info);
 PRELUDE_INFO(base_GHCziWord_W16zh_con_info);
 PRELUDE_INFO(base_GHCziWord_W32zh_con_info);
 PRELUDE_INFO(base_GHCziWord_W64zh_con_info);
-PRELUDE_INFO(base_GHCziStable_StablePtr_static_info);
 PRELUDE_INFO(base_GHCziStable_StablePtr_con_info);
 
 #define Unit_closure              DLL_IMPORT_DATA_REF(ghczmprim_GHCziTuple_Z0T_closure)
@@ -111,22 +94,6 @@ PRELUDE_INFO(base_GHCziStable_StablePtr_con_info);
 #define nestedAtomically_closure  DLL_IMPORT_DATA_REF(base_ControlziExceptionziBase_nestedAtomically_closure)
 #define blockedOnBadFD_closure    DLL_IMPORT_DATA_REF(base_GHCziEventziThread_blockedOnBadFD_closure)
 
-#define Czh_static_info           DLL_IMPORT_DATA_REF(ghczmprim_GHCziTypes_Czh_static_info)
-#define Fzh_static_info           DLL_IMPORT_DATA_REF(ghczmprim_GHCziTypes_Fzh_static_info)
-#define Dzh_static_info           DLL_IMPORT_DATA_REF(ghczmprim_GHCziTypes_Dzh_static_info)
-#define Azh_static_info           DLL_IMPORT_DATA_REF(base_Addr_Azh_static_info)
-#define Izh_static_info           DLL_IMPORT_DATA_REF(ghczmprim_GHCziTypes_Izh_static_info)
-#define I8zh_static_info          DLL_IMPORT_DATA_REF(base_GHCziInt_I8zh_static_info)
-#define I16zh_static_info         DLL_IMPORT_DATA_REF(base_GHCziInt_I16zh_static_info)
-#define I32zh_static_info         DLL_IMPORT_DATA_REF(base_GHCziInt_I32zh_static_info)
-#define I64zh_static_info         DLL_IMPORT_DATA_REF(base_GHCziInt_I64zh_static_info)
-#define Wzh_static_info           DLL_IMPORT_DATA_REF(ghczmprim_GHCziTypes_Wzh_static_info)
-#define W8zh_static_info          DLL_IMPORT_DATA_REF(base_GHCziWord_W8zh_static_info)
-#define W16zh_static_info         DLL_IMPORT_DATA_REF(base_GHCziWord_W16zh_static_info)
-#define W32zh_static_info         DLL_IMPORT_DATA_REF(base_GHCziWord_W32zh_static_info)
-#define W64zh_static_info         DLL_IMPORT_DATA_REF(base_GHCziWord_W64zh_static_info)
-#define Ptr_static_info           DLL_IMPORT_DATA_REF(base_GHCziPtr_Ptr_static_info)
-#define FunPtr_static_info        DLL_IMPORT_DATA_REF(base_GHCziPtr_FunPtr_static_info)
 #define Czh_con_info              DLL_IMPORT_DATA_REF(ghczmprim_GHCziTypes_Czh_con_info)
 #define Izh_con_info              DLL_IMPORT_DATA_REF(ghczmprim_GHCziTypes_Izh_con_info)
 #define Fzh_con_info              DLL_IMPORT_DATA_REF(ghczmprim_GHCziTypes_Fzh_con_info)
index 95dd854..cbbddd6 100644 (file)
@@ -122,8 +122,7 @@ printClosure( const StgClosure *obj )
     case CONSTR:
     case CONSTR_1_0: case CONSTR_0_1:
     case CONSTR_1_1: case CONSTR_0_2: case CONSTR_2_0:
-    case CONSTR_STATIC:
-    case CONSTR_NOCAF_STATIC:
+    case CONSTR_NOCAF:
         {
             StgWord i, j;
             const StgConInfoTable *con_info = get_con_itbl (obj);
@@ -827,8 +826,7 @@ const char *closure_type_names[] = {
  [CONSTR_2_0]            = "CONSTR_2_0",
  [CONSTR_1_1]            = "CONSTR_1_1",
  [CONSTR_0_2]            = "CONSTR_0_2",
- [CONSTR_STATIC]         = "CONSTR_STATIC",
- [CONSTR_NOCAF_STATIC]   = "CONSTR_NOCAF_STATIC",
+ [CONSTR_NOCAF]          = "CONSTR_NOCAF",
  [FUN]                   = "FUN",
  [FUN_1_0]               = "FUN_1_0",
  [FUN_0_1]               = "FUN_0_1",
index c94b3e9..a494a1b 100644 (file)
@@ -139,8 +139,7 @@ closureIdentity( const StgClosure *p )
         case CONSTR_2_0:
         case CONSTR_1_1:
         case CONSTR_0_2:
-        case CONSTR_STATIC:
-        case CONSTR_NOCAF_STATIC:
+        case CONSTR_NOCAF:
             return GET_CON_DESC(itbl_to_con_itbl(info));
         default:
             return closure_type_names[info->type];
@@ -1026,7 +1025,6 @@ heapCensusChain( Census *census, bdescr *bd )
                 size = sizeofW(StgThunkHeader) + 1;
                 break;
 
-            case CONSTR:
             case FUN:
             case BLACKHOLE:
             case BLOCKING_QUEUE:
@@ -1035,6 +1033,8 @@ heapCensusChain( Census *census, bdescr *bd )
             case FUN_1_1:
             case FUN_0_2:
             case FUN_2_0:
+            case CONSTR:
+            case CONSTR_NOCAF:
             case CONSTR_1_0:
             case CONSTR_0_1:
             case CONSTR_1_1:
index ea1e9db..fb2dff5 100644 (file)
@@ -1193,8 +1193,7 @@ fprintCCS_stderr (CostCentreStack *ccs, StgClosure *exception, StgTSO *tso)
         case CONSTR_2_0:
         case CONSTR_1_1:
         case CONSTR_0_2:
-        case CONSTR_STATIC:
-        case CONSTR_NOCAF_STATIC:
+        case CONSTR_NOCAF:
             desc = GET_CON_DESC(itbl_to_con_itbl(info));
             break;
        default:
index 6cd9c89..b954538 100644 (file)
@@ -504,10 +504,10 @@ push( StgClosure *c, retainer c_child_r, StgClosure **first_child )
         // layout.payload.ptrs, no SRT
     case TVAR:
     case CONSTR:
+    case CONSTR_NOCAF:
     case PRIM:
     case MUT_PRIM:
     case BCO:
-    case CONSTR_STATIC:
         init_ptrs(&se.info, get_itbl(c)->layout.payload.ptrs,
                   (StgPtr)c->payload);
         *first_child = find_ptrs(&se.info);
@@ -609,7 +609,6 @@ push( StgClosure *c, retainer c_child_r, StgClosure **first_child )
     case TSO:
     case STACK:
     case IND_STATIC:
-    case CONSTR_NOCAF_STATIC:
         // stack objects
     case UPDATE_FRAME:
     case CATCH_FRAME:
@@ -859,7 +858,6 @@ pop( StgClosure **c, StgClosure **cp, retainer *r )
         case PRIM:
         case MUT_PRIM:
         case BCO:
-        case CONSTR_STATIC:
             // StgMutArrPtr.ptrs, no SRT
         case MUT_ARR_PTRS_CLEAN:
         case MUT_ARR_PTRS_DIRTY:
@@ -938,7 +936,7 @@ pop( StgClosure **c, StgClosure **cp, retainer *r )
         case TSO:
         case STACK:
         case IND_STATIC:
-        case CONSTR_NOCAF_STATIC:
+        case CONSTR_NOCAF:
             // stack objects
         case UPDATE_FRAME:
         case CATCH_FRAME:
@@ -1050,6 +1048,7 @@ isRetainer( StgClosure *c )
 
         // constructors
     case CONSTR:
+    case CONSTR_NOCAF:
     case CONSTR_1_0:
     case CONSTR_0_1:
     case CONSTR_2_0:
@@ -1071,7 +1070,6 @@ isRetainer( StgClosure *c )
     case IND_STATIC:
     case BLACKHOLE:
         // static objects
-    case CONSTR_STATIC:
     case FUN_STATIC:
         // misc
     case PRIM:
@@ -1087,9 +1085,6 @@ isRetainer( StgClosure *c )
         //
         // Error case
         //
-        // CONSTR_NOCAF_STATIC
-        // cannot be *c, *cp, *r in the retainer profiling loop.
-    case CONSTR_NOCAF_STATIC:
         // Stack objects are invalid because they are never treated as
         // legal objects during retainer profiling.
     case UPDATE_FRAME:
@@ -1527,8 +1522,7 @@ inner_loop:
 #ifdef DEBUG_RETAINER
     switch (typeOfc) {
     case IND_STATIC:
-    case CONSTR_NOCAF_STATIC:
-    case CONSTR_STATIC:
+    case CONSTR_NOCAF:
     case THUNK_STATIC:
     case FUN_STATIC:
         break;
@@ -1558,9 +1552,9 @@ inner_loop:
         c = ((StgIndStatic *)c)->indirectee;
         goto inner_loop;
         // static objects with no pointers out, so goto loop.
-    case CONSTR_NOCAF_STATIC:
+    case CONSTR_NOCAF:
         // It is not just enough not to compute the retainer set for *c; it is
-        // mandatory because CONSTR_NOCAF_STATIC are not reachable from
+        // mandatory because CONSTR_NOCAF are not reachable from
         // scavenged_static_objects, the list from which is assumed to traverse
         // all static objects after major garbage collections.
         goto loop;
@@ -1585,7 +1579,7 @@ inner_loop:
             // "appear".  A closure with a non-empty SRT, and which is
             // still required, will always be reachable.
             //
-            // But what about CONSTR_STATIC?  Surely these may be able
+            // But what about CONSTR?  Surely these may be able
             // to appear, and they don't have SRTs, so we can't
             // check.  So for now, we're calling
             // resetStaticObjectForRetainerProfiling() from the
@@ -1819,8 +1813,7 @@ computeRetainerSet( void )
                     case IND_STATIC:
                         // no cost involved
                         break;
-                    case CONSTR_NOCAF_STATIC:
-                    case CONSTR_STATIC:
+                    case CONSTR_NOCAF:
                     case THUNK_STATIC:
                     case FUN_STATIC:
                         barf("Invalid object in computeRetainerSet(): %d", get_itbl((StgClosure*)ml)->type);
@@ -1896,7 +1889,11 @@ resetStaticObjectForRetainerProfiling( StgClosure *static_objects )
             maybeInitRetainerSet(p);
             p = (StgClosure*)*FUN_STATIC_LINK(p);
             break;
-        case CONSTR_STATIC:
+        case CONSTR:
+        case CONSTR_1_0:
+        case CONSTR_2_0:
+        case CONSTR_1_1:
+        case CONSTR_NOCAF:
             maybeInitRetainerSet(p);
             p = (StgClosure*)*STATIC_LINK(get_itbl(p), p);
             break;
@@ -1958,8 +1955,7 @@ retainerProfile(void)
     debugBelch("costArrayLinear[" #index "] = %u\n", costArrayLinear[index])
   pcostArrayLinear(THUNK_STATIC);
   pcostArrayLinear(FUN_STATIC);
-  pcostArrayLinear(CONSTR_STATIC);
-  pcostArrayLinear(CONSTR_NOCAF_STATIC);
+  pcostArrayLinear(CONSTR_NOCAF);
 */
 #endif
 
@@ -2067,7 +2063,6 @@ static uint32_t
 sanityCheckHeapClosure( StgClosure *c )
 {
     ASSERT(LOOKS_LIKE_GHC_INFO(c->header.info));
-    ASSERT(!closure_STATIC(c));
     ASSERT(LOOKS_LIKE_PTR(c));
 
     if ((((StgWord)RSET(c) & 1) ^ flip) != 0) {
index 320816b..86771ae 100644 (file)
@@ -13,8 +13,8 @@
 #include "Cmm.h"
 
 import pthread_mutex_lock;
-import ghczmprim_GHCziTypes_Czh_static_info;
-import ghczmprim_GHCziTypes_Izh_static_info;
+import ghczmprim_GHCziTypes_Czh_info;
+import ghczmprim_GHCziTypes_Izh_info;
 import EnterCriticalSection;
 import LeaveCriticalSection;
 
@@ -423,7 +423,7 @@ INFO_TABLE_CONSTR(stg_C_FINALIZER_LIST,1,4,0,CONSTR,"C_FINALIZER_LIST","C_FINALI
    finalizer in a weak pointer object.
    ------------------------------------------------------------------------- */
 
-INFO_TABLE_CONSTR(stg_NO_FINALIZER,0,0,0,CONSTR_NOCAF_STATIC,"NO_FINALIZER","NO_FINALIZER")
+INFO_TABLE_CONSTR(stg_NO_FINALIZER,0,0,0,CONSTR_NOCAF,"NO_FINALIZER","NO_FINALIZER")
 { foreign "C" barf("NO_FINALIZER object entered!") never returns; }
 
 CLOSURE(stg_NO_FINALIZER_closure,stg_NO_FINALIZER);
@@ -473,16 +473,16 @@ INFO_TABLE(stg_TREC_CHUNK, 0, 0, TREC_CHUNK, "TREC_CHUNK", "TREC_CHUNK")
 INFO_TABLE(stg_TREC_HEADER, 3, 1, MUT_PRIM, "TREC_HEADER", "TREC_HEADER")
 { foreign "C" barf("TREC_HEADER object entered!") never returns; }
 
-INFO_TABLE_CONSTR(stg_END_STM_WATCH_QUEUE,0,0,0,CONSTR_NOCAF_STATIC,"END_STM_WATCH_QUEUE","END_STM_WATCH_QUEUE")
+INFO_TABLE_CONSTR(stg_END_STM_WATCH_QUEUE,0,0,0,CONSTR_NOCAF,"END_STM_WATCH_QUEUE","END_STM_WATCH_QUEUE")
 { foreign "C" barf("END_STM_WATCH_QUEUE object entered!") never returns; }
 
-INFO_TABLE_CONSTR(stg_END_INVARIANT_CHECK_QUEUE,0,0,0,CONSTR_NOCAF_STATIC,"END_INVARIANT_CHECK_QUEUE","END_INVARIANT_CHECK_QUEUE")
+INFO_TABLE_CONSTR(stg_END_INVARIANT_CHECK_QUEUE,0,0,0,CONSTR_NOCAF,"END_INVARIANT_CHECK_QUEUE","END_INVARIANT_CHECK_QUEUE")
 { foreign "C" barf("END_INVARIANT_CHECK_QUEUE object entered!") never returns; }
 
-INFO_TABLE_CONSTR(stg_END_STM_CHUNK_LIST,0,0,0,CONSTR_NOCAF_STATIC,"END_STM_CHUNK_LIST","END_STM_CHUNK_LIST")
+INFO_TABLE_CONSTR(stg_END_STM_CHUNK_LIST,0,0,0,CONSTR_NOCAF,"END_STM_CHUNK_LIST","END_STM_CHUNK_LIST")
 { foreign "C" barf("END_STM_CHUNK_LIST object entered!") never returns; }
 
-INFO_TABLE_CONSTR(stg_NO_TREC,0,0,0,CONSTR_NOCAF_STATIC,"NO_TREC","NO_TREC")
+INFO_TABLE_CONSTR(stg_NO_TREC,0,0,0,CONSTR_NOCAF,"NO_TREC","NO_TREC")
 { foreign "C" barf("NO_TREC object entered!") never returns; }
 
 CLOSURE(stg_END_STM_WATCH_QUEUE_closure,stg_END_STM_WATCH_QUEUE);
@@ -519,7 +519,7 @@ INFO_TABLE_CONSTR(stg_MSG_NULL,1,0,0,PRIM,"MSG_NULL","MSG_NULL")
    end of a linked TSO queue.
    ------------------------------------------------------------------------- */
 
-INFO_TABLE_CONSTR(stg_END_TSO_QUEUE,0,0,0,CONSTR_NOCAF_STATIC,"END_TSO_QUEUE","END_TSO_QUEUE")
+INFO_TABLE_CONSTR(stg_END_TSO_QUEUE,0,0,0,CONSTR_NOCAF,"END_TSO_QUEUE","END_TSO_QUEUE")
 { foreign "C" barf("END_TSO_QUEUE object entered!") never returns; }
 
 CLOSURE(stg_END_TSO_QUEUE_closure,stg_END_TSO_QUEUE);
@@ -528,7 +528,7 @@ CLOSURE(stg_END_TSO_QUEUE_closure,stg_END_TSO_QUEUE);
    GCD_CAF
    ------------------------------------------------------------------------- */
 
-INFO_TABLE_CONSTR(stg_GCD_CAF,0,0,0,CONSTR_NOCAF_STATIC,"GCD_CAF","GCD_CAF")
+INFO_TABLE_CONSTR(stg_GCD_CAF,0,0,0,CONSTR_NOCAF,"GCD_CAF","GCD_CAF")
 { foreign "C" barf("Evaluated a CAF that was GC'd!") never returns; }
 
 /* ----------------------------------------------------------------------------
@@ -538,7 +538,7 @@ INFO_TABLE_CONSTR(stg_GCD_CAF,0,0,0,CONSTR_NOCAF_STATIC,"GCD_CAF","GCD_CAF")
    thread waiting on an STM wakeup
    ------------------------------------------------------------------------- */
 
-INFO_TABLE_CONSTR(stg_STM_AWOKEN,0,0,0,CONSTR_NOCAF_STATIC,"STM_AWOKEN","STM_AWOKEN")
+INFO_TABLE_CONSTR(stg_STM_AWOKEN,0,0,0,CONSTR_NOCAF,"STM_AWOKEN","STM_AWOKEN")
 { foreign "C" barf("STM_AWOKEN object entered!") never returns; }
 
 CLOSURE(stg_STM_AWOKEN_closure,stg_STM_AWOKEN);
@@ -602,7 +602,7 @@ INFO_TABLE(stg_MUT_VAR_DIRTY, 1, 0, MUT_VAR_DIRTY, "MUT_VAR_DIRTY", "MUT_VAR_DIR
    just enter the top stack word to start the thread.  (see deleteThread)
  * ------------------------------------------------------------------------- */
 
-INFO_TABLE( stg_dummy_ret, 0, 0, CONSTR_NOCAF_STATIC, "DUMMY_RET", "DUMMY_RET")
+INFO_TABLE( stg_dummy_ret, 0, 0, CONSTR_NOCAF, "DUMMY_RET", "DUMMY_RET")
     ()
 {
     return ();
@@ -646,20 +646,16 @@ INFO_TABLE( stg_COMPACT_NFDATA, 0, 0, COMPACT_NFDATA, "COMPACT_NFDATA", "COMPACT
  *    we don't rewrite to static closures at all with Windows DLLs.
  */
 // #warning Is this correct? _imp is a pointer!
-#define Char_hash_static_info _imp__ghczmprim_GHCziTypes_Czh_static_info
-#define Int_hash_static_info _imp__ghczmprim_GHCziTypes_Izh_static_info
+#define Char_hash_con_info _imp__ghczmprim_GHCziTypes_Czh_con_info
+#define Int_hash_con_info _imp__ghczmprim_GHCziTypes_Izh_con_info
 #else
-#define Char_hash_static_info ghczmprim_GHCziTypes_Czh_static_info
-#define Int_hash_static_info ghczmprim_GHCziTypes_Izh_static_info
+#define Char_hash_con_info ghczmprim_GHCziTypes_Czh_con_info
+#define Int_hash_con_info ghczmprim_GHCziTypes_Izh_con_info
 #endif
 
 
-#define CHARLIKE_HDR(n)  CLOSURE(Char_hash_static_info, n)
-#define INTLIKE_HDR(n)   CLOSURE(Int_hash_static_info, n)
-
-/* put these in the *data* section, since the garbage collector relies
- * on the fact that static closures live in the data section.
- */
+#define CHARLIKE_HDR(n)  CLOSURE(Char_hash_con_info, n)
+#define INTLIKE_HDR(n)   CLOSURE(Int_hash_con_info, n)
 
 #if !(defined(COMPILING_WINDOWS_DLL))
 section "data" {
index f8e706a..5fa148d 100644 (file)
@@ -621,8 +621,7 @@ simple_scavenge_block (Capability            *cap,
 
         case CONSTR:
         case PRIM:
-        case CONSTR_NOCAF_STATIC:
-        case CONSTR_STATIC:
+        case CONSTR_NOCAF:
         {
             StgPtr end;
 
@@ -705,8 +704,7 @@ objectIsWHNFData (StgClosure *what)
     case CONSTR_2_0:
     case CONSTR_1_1:
     case CONSTR_0_2:
-    case CONSTR_STATIC:
-    case CONSTR_NOCAF_STATIC:
+    case CONSTR_NOCAF:
     case ARR_WORDS:
     case MUT_ARR_PTRS_FROZEN:
     case MUT_ARR_PTRS_FROZEN0:
@@ -776,8 +774,7 @@ verify_consistency_block (StgCompactNFData *str, StgCompactNFDataBlock *block)
 
         case CONSTR:
         case PRIM:
-        case CONSTR_STATIC:
-        case CONSTR_NOCAF_STATIC:
+        case CONSTR_NOCAF:
         {
             uint32_t i;
 
@@ -1108,8 +1105,7 @@ fixup_block(StgCompactNFDataBlock *block, StgWord *fixup_table, uint32_t count)
 
         case CONSTR:
         case PRIM:
-        case CONSTR_STATIC:
-        case CONSTR_NOCAF_STATIC:
+        case CONSTR_NOCAF:
         {
             StgPtr end;
 
index 3528fab..1f7f087 100644 (file)
@@ -214,7 +214,13 @@ thread_static( StgClosure* p )
     case FUN_STATIC:
         p = *FUN_STATIC_LINK(p);
         continue;
-    case CONSTR_STATIC:
+    case CONSTR:
+    case CONSTR_NOCAF:
+    case CONSTR_1_0:
+    case CONSTR_0_1:
+    case CONSTR_2_0:
+    case CONSTR_1_1:
+    case CONSTR_0_2:
         p = *STATIC_LINK(info,p);
         continue;
 
@@ -609,6 +615,7 @@ thread_obj (const StgInfoTable *info, StgPtr p)
 
     case FUN:
     case CONSTR:
+    case CONSTR_NOCAF:
     case PRIM:
     case MUT_PRIM:
     case MUT_VAR_CLEAN:
index 1f9c5cc..1323cbe 100644 (file)
@@ -548,11 +548,16 @@ loop:
           evacuate_static_object(IND_STATIC_LINK((StgClosure *)q), q);
           return;
 
-      case CONSTR_STATIC:
+      case CONSTR:
+      case CONSTR_1_0:
+      case CONSTR_2_0:
+      case CONSTR_1_1:
           evacuate_static_object(STATIC_LINK(info,(StgClosure *)q), q);
           return;
 
-      case CONSTR_NOCAF_STATIC:
+      case CONSTR_0_1:
+      case CONSTR_0_2:
+      case CONSTR_NOCAF:
           /* no need to put these on the static linked list, they don't need
            * to be scavenged.
            */
@@ -716,6 +721,7 @@ loop:
 
   case FUN:
   case CONSTR:
+  case CONSTR_NOCAF:
       copy_tag_nolock(p,info,q,sizeW_fromITBL(INFO_PTR_TO_STRUCT(info)),gen_no,tag);
       return;
 
@@ -1048,8 +1054,7 @@ selector_loop:
       case CONSTR_2_0:
       case CONSTR_1_1:
       case CONSTR_0_2:
-      case CONSTR_STATIC:
-      case CONSTR_NOCAF_STATIC:
+      case CONSTR_NOCAF:
           {
               // check that the size is in range
               ASSERT(field <  (StgWord32)(info->layout.payload.ptrs +
index 6265bf9..23ed3f0 100644 (file)
@@ -51,7 +51,7 @@ isAlive(StgClosure *p)
     //
     // ToDo: for static closures, check the static link field.
     // Problem here is that we sometimes don't set the link field, eg.
-    // for static closures with an empty SRT or CONSTR_STATIC_NOCAFs.
+    // for static closures with an empty SRT or CONSTR_NOCAFs.
     //
     if (!HEAP_ALLOCED_GC(q)) {
         return p;
index f1b57ea..413aee9 100644 (file)
@@ -86,13 +86,6 @@ checkClosureShallow( const StgClosure* p )
 
     q = UNTAG_CONST_CLOSURE(p);
     ASSERT(LOOKS_LIKE_CLOSURE_PTR(q));
-
-    /* Is it a static closure? */
-    if (!HEAP_ALLOCED(q)) {
-        ASSERT(closure_STATIC(q));
-    } else {
-        ASSERT(!closure_STATIC(q));
-    }
 }
 
 // check an individual stack object
@@ -225,12 +218,6 @@ checkClosure( const StgClosure* p )
     ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
 
     p = UNTAG_CONST_CLOSURE(p);
-    /* Is it a static closure (i.e. in the data segment)? */
-    if (!HEAP_ALLOCED(p)) {
-        ASSERT(closure_STATIC(p));
-    } else {
-        ASSERT(!closure_STATIC(p));
-    }
 
     info = p->header.info;
 
@@ -272,6 +259,7 @@ checkClosure( const StgClosure* p )
     case FUN_0_2:
     case FUN_2_0:
     case CONSTR:
+    case CONSTR_NOCAF:
     case CONSTR_1_0:
     case CONSTR_0_1:
     case CONSTR_1_1:
@@ -283,8 +271,6 @@ checkClosure( const StgClosure* p )
     case MUT_VAR_CLEAN:
     case MUT_VAR_DIRTY:
     case TVAR:
-    case CONSTR_STATIC:
-    case CONSTR_NOCAF_STATIC:
     case THUNK_STATIC:
     case FUN_STATIC:
         {
@@ -692,7 +678,11 @@ checkStaticObjects ( StgClosure* static_objects )
       p = *FUN_STATIC_LINK((StgClosure *)p);
       break;
 
-    case CONSTR_STATIC:
+    case CONSTR:
+    case CONSTR_NOCAF:
+    case CONSTR_1_0:
+    case CONSTR_2_0:
+    case CONSTR_1_1:
       p = *STATIC_LINK(info,(StgClosure *)p);
       break;
 
index 1549df5..595d827 100644 (file)
@@ -560,6 +560,7 @@ scavenge_block (bdescr *bd)
 
     gen_obj:
     case CONSTR:
+    case CONSTR_NOCAF:
     case WEAK:
     case PRIM:
     {
@@ -968,6 +969,7 @@ scavenge_mark_stack(void)
 
         gen_obj:
         case CONSTR:
+        case CONSTR_NOCAF:
         case WEAK:
         case PRIM:
         {
@@ -1290,6 +1292,7 @@ scavenge_one(StgPtr p)
     case FUN_0_2:
     case FUN_2_0:
     case CONSTR:
+    case CONSTR_NOCAF:
     case CONSTR_1_0:
     case CONSTR_0_1:
     case CONSTR_1_1:
@@ -1754,7 +1757,13 @@ scavenge_static(void)
       scavenge_fun_srt(info);
       break;
 
-    case CONSTR_STATIC:
+    case CONSTR:
+    case CONSTR_NOCAF:
+    case CONSTR_1_0:
+    case CONSTR_0_1:
+    case CONSTR_2_0:
+    case CONSTR_1_1:
+    case CONSTR_0_2:
       {
         StgPtr q, next;