diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2020-04-12 19:08:58 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-04-14 23:31:38 -0400 |
commit | 19de2fb090a25ab0d640d0cd5aef09f35e7455a0 (patch) | |
tree | aa76c39e33f0cb6f6ebf5f9265ed5a6dc19dc323 /rts | |
parent | 1dd3d18c2afd9e6009cd53295d26f8b31ca58fec (diff) | |
download | haskell-19de2fb090a25ab0d640d0cd5aef09f35e7455a0.tar.gz |
rts: Assert LDV_recordDead is not called for inherently used closures
The comments make it clear LDV_recordDead should not be called for
inhererently used closures, so add an assertion to codify this fact.
Diffstat (limited to 'rts')
-rw-r--r-- | rts/LdvProfile.c | 59 | ||||
-rw-r--r-- | rts/ProfHeap.c | 2 |
2 files changed, 37 insertions, 24 deletions
diff --git a/rts/LdvProfile.c b/rts/LdvProfile.c index cf57f28eae..71064ddbce 100644 --- a/rts/LdvProfile.c +++ b/rts/LdvProfile.c @@ -18,6 +18,37 @@ #include "RtsUtils.h" #include "Schedule.h" +bool isInherentlyUsed( StgHalfWord closure_type ) +{ + switch(closure_type) { + case TSO: + case STACK: + case MVAR_CLEAN: + case MVAR_DIRTY: + case TVAR: + case MUT_ARR_PTRS_CLEAN: + case MUT_ARR_PTRS_DIRTY: + case MUT_ARR_PTRS_FROZEN_CLEAN: + case MUT_ARR_PTRS_FROZEN_DIRTY: + case SMALL_MUT_ARR_PTRS_CLEAN: + case SMALL_MUT_ARR_PTRS_DIRTY: + case SMALL_MUT_ARR_PTRS_FROZEN_CLEAN: + case SMALL_MUT_ARR_PTRS_FROZEN_DIRTY: + case ARR_WORDS: + case WEAK: + case MUT_VAR_CLEAN: + case MUT_VAR_DIRTY: + case BCO: + case PRIM: + case MUT_PRIM: + case TREC_CHUNK: + return true; + + default: + return false; + } +} + /* -------------------------------------------------------------------------- * This function is called eventually on every object destroyed during * a garbage collection, whether it is a major garbage collection or @@ -55,33 +86,13 @@ processHeapClosureForDead( const StgClosure *c ) size = closure_sizeW(c); - switch (info->type) { - /* + /* 'inherently used' cases: do nothing. - */ - case TSO: - case STACK: - case MVAR_CLEAN: - case MVAR_DIRTY: - case TVAR: - case MUT_ARR_PTRS_CLEAN: - case MUT_ARR_PTRS_DIRTY: - case MUT_ARR_PTRS_FROZEN_CLEAN: - case MUT_ARR_PTRS_FROZEN_DIRTY: - case SMALL_MUT_ARR_PTRS_CLEAN: - case SMALL_MUT_ARR_PTRS_DIRTY: - case SMALL_MUT_ARR_PTRS_FROZEN_CLEAN: - case SMALL_MUT_ARR_PTRS_FROZEN_DIRTY: - case ARR_WORDS: - case WEAK: - case MUT_VAR_CLEAN: - case MUT_VAR_DIRTY: - case BCO: - case PRIM: - case MUT_PRIM: - case TREC_CHUNK: + */ + if(isInherentlyUsed(info->type)) return size; + switch (info->type) { /* ordinary cases: call LDV_recordDead(). */ diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index 8f7b65d7a4..03c99a0d49 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -280,6 +280,8 @@ LDV_recordDead( const StgClosure *c, uint32_t size ) uint32_t t; counter *ctr; + ASSERT(!isInherentlyUsed(get_itbl(c)->type)); + if (era > 0 && closureSatisfiesConstraints(c)) { size -= sizeofW(StgProfHeader); ASSERT(LDVW(c) != 0); |