summaryrefslogtreecommitdiff
path: root/rts/ClosureSize.c
diff options
context:
space:
mode:
authorDouglas Wilson <douglas.wilson@gmail.com>2021-12-19 12:55:56 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-02-02 19:26:06 -0500
commit05548a2209f71b407028d42e1aad566697263199 (patch)
tree8b2220cc2134b9d711692a34d00b59fba54bae49 /rts/ClosureSize.c
parent88fba8a4b3c22e953a634b81dd0b67ec66eb5e72 (diff)
downloadhaskell-05548a2209f71b407028d42e1aad566697263199.tar.gz
rts: Address failures to inline
Diffstat (limited to 'rts/ClosureSize.c')
-rw-r--r--rts/ClosureSize.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/rts/ClosureSize.c b/rts/ClosureSize.c
new file mode 100644
index 0000000000..8fa99c6e6e
--- /dev/null
+++ b/rts/ClosureSize.c
@@ -0,0 +1,69 @@
+/* -----------------------------------------------------------------------------
+ *
+ * (c) The GHC Team 2021
+ *
+ * Implementation of closure_sizeW_
+ *
+ * ---------------------------------------------------------------------------*/
+
+#include "Rts.h"
+
+uint32_t
+closure_sizeW_ (const StgClosure *p, const StgInfoTable *info)
+{
+ switch (info->type) {
+ case THUNK_0_1:
+ case THUNK_1_0:
+ return sizeofW(StgThunk) + 1;
+ case FUN_0_1:
+ case CONSTR_0_1:
+ case FUN_1_0:
+ case CONSTR_1_0:
+ return sizeofW(StgHeader) + 1;
+ case THUNK_0_2:
+ case THUNK_1_1:
+ case THUNK_2_0:
+ return sizeofW(StgThunk) + 2;
+ case FUN_0_2:
+ case CONSTR_0_2:
+ case FUN_1_1:
+ case CONSTR_1_1:
+ case FUN_2_0:
+ case CONSTR_2_0:
+ return sizeofW(StgHeader) + 2;
+ case THUNK:
+ return thunk_sizeW_fromITBL(info);
+ case THUNK_SELECTOR:
+ return THUNK_SELECTOR_sizeW();
+ case AP_STACK:
+ return ap_stack_sizeW((StgAP_STACK *)p);
+ case AP:
+ return ap_sizeW((StgAP *)p);
+ case PAP:
+ return pap_sizeW((StgPAP *)p);
+ case IND:
+ return sizeofW(StgInd);
+ case ARR_WORDS:
+ return arr_words_sizeW((StgArrBytes *)p);
+ case MUT_ARR_PTRS_CLEAN:
+ case MUT_ARR_PTRS_DIRTY:
+ case MUT_ARR_PTRS_FROZEN_CLEAN:
+ case MUT_ARR_PTRS_FROZEN_DIRTY:
+ return mut_arr_ptrs_sizeW((StgMutArrPtrs*)p);
+ 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:
+ return small_mut_arr_ptrs_sizeW((StgSmallMutArrPtrs*)p);
+ case TSO:
+ return sizeofW(StgTSO);
+ case STACK:
+ return stack_sizeW((StgStack*)p);
+ case BCO:
+ return bco_sizeW((StgBCO *)p);
+ case TREC_CHUNK:
+ return sizeofW(StgTRecChunk);
+ default:
+ return sizeW_fromITBL(info);
+ }
+}