summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2016-11-09 09:20:02 +0000
committerSimon Marlow <marlowsd@gmail.com>2016-11-14 14:43:35 +0000
commit55d535da10dd63bbaf03fb176ced7179087cd0d4 (patch)
tree57bdbf04381fe08d90c384f5b10e77c3384227d9
parent6c0f10fac767c49b65ed71e8eb8e78ca4f9062d5 (diff)
downloadhaskell-55d535da10dd63bbaf03fb176ced7179087cd0d4.tar.gz
Remove CONSTR_STATIC
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
-rw-r--r--compiler/cmm/CLabel.hs19
-rw-r--r--compiler/cmm/SMRep.hs54
-rw-r--r--compiler/codeGen/StgCmm.hs52
-rw-r--r--compiler/codeGen/StgCmmClosure.hs14
-rw-r--r--compiler/ghci/RtClosureInspect.hs2
-rw-r--r--docs/rts/rts.tex2
-rw-r--r--includes/rts/storage/ClosureTypes.h131
-rw-r--r--includes/rts/storage/InfoTables.h16
-rw-r--r--rts/CheckUnload.c3
-rw-r--r--rts/ClosureFlags.c133
-rw-r--r--rts/Interpreter.c3
-rw-r--r--rts/LdvProfile.c3
-rw-r--r--rts/Prelude.h33
-rw-r--r--rts/Printer.c6
-rw-r--r--rts/ProfHeap.c6
-rw-r--r--rts/Profiling.c3
-rw-r--r--rts/RetainerProfile.c33
-rw-r--r--rts/StgMiscClosures.cmm38
-rw-r--r--rts/sm/CNF.c12
-rw-r--r--rts/sm/Compact.c9
-rw-r--r--rts/sm/Evac.c13
-rw-r--r--rts/sm/GCAux.c2
-rw-r--r--rts/sm/Sanity.c22
-rw-r--r--rts/sm/Scav.c11
24 files changed, 281 insertions, 339 deletions
diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs
index b262371b65..0b64e3e1ff 100644
--- a/compiler/cmm/CLabel.hs
+++ b/compiler/cmm/CLabel.hs
@@ -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"
)
diff --git a/compiler/cmm/SMRep.hs b/compiler/cmm/SMRep.hs
index ecd8905cbb..83ddf18586 100644
--- a/compiler/cmm/SMRep.hs
+++ b/compiler/cmm/SMRep.hs
@@ -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
diff --git a/compiler/codeGen/StgCmm.hs b/compiler/codeGen/StgCmm.hs
index 28ca97d9a2..aac556d43f 100644
--- a/compiler/codeGen/StgCmm.hs
+++ b/compiler/codeGen/StgCmm.hs
@@ -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
diff --git a/compiler/codeGen/StgCmmClosure.hs b/compiler/codeGen/StgCmmClosure.hs
index 23b803cc56..0ce119b0bb 100644
--- a/compiler/codeGen/StgCmmClosure.hs
+++ b/compiler/codeGen/StgCmmClosure.hs
@@ -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)
diff --git a/compiler/ghci/RtClosureInspect.hs b/compiler/ghci/RtClosureInspect.hs
index eff266090e..815e5e6e0f 100644
--- a/compiler/ghci/RtClosureInspect.hs
+++ b/compiler/ghci/RtClosureInspect.hs
@@ -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
diff --git a/docs/rts/rts.tex b/docs/rts/rts.tex
index 809705e3d1..191d65da9c 100644
--- a/docs/rts/rts.tex
+++ b/docs/rts/rts.tex
@@ -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.
diff --git a/includes/rts/storage/ClosureTypes.h b/includes/rts/storage/ClosureTypes.h
index f5e96e7500..234e00b174 100644
--- a/includes/rts/storage/ClosureTypes.h
+++ b/includes/rts/storage/ClosureTypes.h
@@ -18,71 +18,70 @@
*/
/* 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 */
diff --git a/includes/rts/storage/InfoTables.h b/includes/rts/storage/InfoTables.h
index bb1bac0c65..87d0410937 100644
--- a/includes/rts/storage/InfoTables.h
+++ b/includes/rts/storage/InfoTables.h
@@ -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)
diff --git a/rts/CheckUnload.c b/rts/CheckUnload.c
index d303315981..03e4e22a47 100644
--- a/rts/CheckUnload.c
+++ b/rts/CheckUnload.c
@@ -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:
diff --git a/rts/ClosureFlags.c b/rts/ClosureFlags.c
index b2359107a5..9bf301552d 100644
--- a/rts/ClosureFlags.c
+++ b/rts/ClosureFlags.c
@@ -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
diff --git a/rts/Interpreter.c b/rts/Interpreter.c
index f88e47493c..5e796cd842 100644
--- a/rts/Interpreter.c
+++ b/rts/Interpreter.c
@@ -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:
diff --git a/rts/LdvProfile.c b/rts/LdvProfile.c
index 26ead95061..38a3563880 100644
--- a/rts/LdvProfile.c
+++ b/rts/LdvProfile.c
@@ -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:
diff --git a/rts/Prelude.h b/rts/Prelude.h
index 58de23013b..16881eb423 100644
--- a/rts/Prelude.h
+++ b/rts/Prelude.h
@@ -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)
diff --git a/rts/Printer.c b/rts/Printer.c
index 95dd8548f2..cbbddd6641 100644
--- a/rts/Printer.c
+++ b/rts/Printer.c
@@ -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",
diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c
index c94b3e9ec8..a494a1b5a2 100644
--- a/rts/ProfHeap.c
+++ b/rts/ProfHeap.c
@@ -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:
diff --git a/rts/Profiling.c b/rts/Profiling.c
index ea1e9dbb2e..fb2dff5f3a 100644
--- a/rts/Profiling.c
+++ b/rts/Profiling.c
@@ -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:
diff --git a/rts/RetainerProfile.c b/rts/RetainerProfile.c
index 6cd9c89b83..b9545387f5 100644
--- a/rts/RetainerProfile.c
+++ b/rts/RetainerProfile.c
@@ -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) {
diff --git a/rts/StgMiscClosures.cmm b/rts/StgMiscClosures.cmm
index 320816bfbf..86771aeba0 100644
--- a/rts/StgMiscClosures.cmm
+++ b/rts/StgMiscClosures.cmm
@@ -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" {
diff --git a/rts/sm/CNF.c b/rts/sm/CNF.c
index f8e706aaf4..5fa148d426 100644
--- a/rts/sm/CNF.c
+++ b/rts/sm/CNF.c
@@ -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;
diff --git a/rts/sm/Compact.c b/rts/sm/Compact.c
index 3528fabb7b..1f7f08748a 100644
--- a/rts/sm/Compact.c
+++ b/rts/sm/Compact.c
@@ -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:
diff --git a/rts/sm/Evac.c b/rts/sm/Evac.c
index 1f9c5cc8cd..1323cbea6a 100644
--- a/rts/sm/Evac.c
+++ b/rts/sm/Evac.c
@@ -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 +
diff --git a/rts/sm/GCAux.c b/rts/sm/GCAux.c
index 6265bf9ca1..23ed3f0622 100644
--- a/rts/sm/GCAux.c
+++ b/rts/sm/GCAux.c
@@ -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;
diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c
index f1b57eae66..413aee945b 100644
--- a/rts/sm/Sanity.c
+++ b/rts/sm/Sanity.c
@@ -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;
diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c
index 1549df5021..595d8275cf 100644
--- a/rts/sm/Scav.c
+++ b/rts/sm/Scav.c
@@ -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;