summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-02-14 13:51:37 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-04-22 02:12:59 -0400
commit1e062a8a220c2fb5d707c7e36c6532d0e16291e9 (patch)
tree795683c5a8286f28ae849e9b418831a73f8e2493
parent0481a6af8d5d0279809bd14082d9f2d988da6df2 (diff)
downloadhaskell-1e062a8a220c2fb5d707c7e36c6532d0e16291e9.tar.gz
rts: Introduce ip_STACK_FRAME
While debugging it is very useful to be able to determine whether a given info table is a stack frame or not. We have spare bits in the closure flags array anyways, use one for this information.
-rw-r--r--rts/ClosureFlags.c132
-rw-r--r--rts/include/rts/storage/InfoTables.h2
2 files changed, 68 insertions, 66 deletions
diff --git a/rts/ClosureFlags.c b/rts/ClosureFlags.c
index 390e11900b..9007a9b5df 100644
--- a/rts/ClosureFlags.c
+++ b/rts/ClosureFlags.c
@@ -20,73 +20,73 @@ StgWord16 closure_flags[] = {
/* See InfoTables.h for the meaning of these flags */
-/* 0 1 2 4 5 6 7 8 */
-/* HNF BTM NS THU MUT UPT SRT IND */
+/* 0 1 2 4 5 6 7 8 9 */
+/* HNF BTM NS THU MUT UPT SRT IND FRM */
- [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_FROZEN_DIRTY] = (_HNF| _NS| _MUT|_UPT ),
- [MUT_ARR_PTRS_FROZEN_CLEAN] = (_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_FROZEN_DIRTY] = (_HNF| _NS| _MUT|_UPT ),
- [SMALL_MUT_ARR_PTRS_FROZEN_CLEAN] = (_HNF| _NS| _UPT ),
- [COMPACT_NFDATA] = (_HNF| _NS ),
+ [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] = ( _FRM ),
+ [RET_SMALL] = ( _BTM| _SRT| _FRM ),
+ [RET_BIG] = ( _SRT| _FRM ),
+ [RET_FUN] = ( _FRM ),
+ [UPDATE_FRAME] = ( _BTM| _FRM ),
+ [CATCH_FRAME] = ( _BTM| _FRM ),
+ [UNDERFLOW_FRAME] = ( _BTM| _FRM ),
+ [STOP_FRAME] = ( _BTM| _FRM ),
+ [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_FROZEN_DIRTY] = (_HNF| _NS| _MUT|_UPT ),
+ [MUT_ARR_PTRS_FROZEN_CLEAN] = (_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| _FRM ),
+ [CATCH_RETRY_FRAME] = ( _BTM| _FRM ),
+ [CATCH_STM_FRAME] = ( _BTM| _FRM ),
+ [WHITEHOLE] = ( 0 ),
+ [SMALL_MUT_ARR_PTRS_CLEAN] = (_HNF| _NS| _MUT|_UPT ),
+ [SMALL_MUT_ARR_PTRS_DIRTY] = (_HNF| _NS| _MUT|_UPT ),
+ [SMALL_MUT_ARR_PTRS_FROZEN_DIRTY] = (_HNF| _NS| _MUT|_UPT ),
+ [SMALL_MUT_ARR_PTRS_FROZEN_CLEAN] = (_HNF| _NS| _UPT ),
+ [COMPACT_NFDATA] = (_HNF| _NS ),
};
#if N_CLOSURE_TYPES != 64
diff --git a/rts/include/rts/storage/InfoTables.h b/rts/include/rts/storage/InfoTables.h
index 55aba6b4d7..b5102c8b8d 100644
--- a/rts/include/rts/storage/InfoTables.h
+++ b/rts/include/rts/storage/InfoTables.h
@@ -62,6 +62,7 @@ typedef struct {
#define _UPT (1<<5) /* unpointed? */
#define _SRT (1<<6) /* has an SRT? */
#define _IND (1<<7) /* is an indirection? */
+#define _FRM (1<<8) /* is a stack frame? */
#define isMUTABLE(flags) ((flags) &_MUT)
#define isBITMAP(flags) ((flags) &_BTM)
@@ -95,6 +96,7 @@ extern StgWord16 closure_flags[];
#define ip_UNPOINTED(ip) ( ipFlags(ip) & _UPT)
#define ip_SRT(ip) ( ipFlags(ip) & _SRT)
#define ip_IND(ip) ( ipFlags(ip) & _IND)
+#define ip_STACK_FRAME(ip) ( ipFlags(ip) & _FRM)
/* -----------------------------------------------------------------------------
Bitmaps