diff options
author | Simon Marlow <marlowsd@gmail.com> | 2016-11-09 09:20:02 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2016-11-14 14:43:35 +0000 |
commit | 55d535da10dd63bbaf03fb176ced7179087cd0d4 (patch) | |
tree | 57bdbf04381fe08d90c384f5b10e77c3384227d9 /rts | |
parent | 6c0f10fac767c49b65ed71e8eb8e78ca4f9062d5 (diff) | |
download | haskell-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
Diffstat (limited to 'rts')
-rw-r--r-- | rts/CheckUnload.c | 3 | ||||
-rw-r--r-- | rts/ClosureFlags.c | 133 | ||||
-rw-r--r-- | rts/Interpreter.c | 3 | ||||
-rw-r--r-- | rts/LdvProfile.c | 3 | ||||
-rw-r--r-- | rts/Prelude.h | 33 | ||||
-rw-r--r-- | rts/Printer.c | 6 | ||||
-rw-r--r-- | rts/ProfHeap.c | 6 | ||||
-rw-r--r-- | rts/Profiling.c | 3 | ||||
-rw-r--r-- | rts/RetainerProfile.c | 33 | ||||
-rw-r--r-- | rts/StgMiscClosures.cmm | 38 | ||||
-rw-r--r-- | rts/sm/CNF.c | 12 | ||||
-rw-r--r-- | rts/sm/Compact.c | 9 | ||||
-rw-r--r-- | rts/sm/Evac.c | 13 | ||||
-rw-r--r-- | rts/sm/GCAux.c | 2 | ||||
-rw-r--r-- | rts/sm/Sanity.c | 22 | ||||
-rw-r--r-- | rts/sm/Scav.c | 11 |
16 files changed, 145 insertions, 185 deletions
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; |