summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2022-04-26 08:19:16 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-05-16 08:31:20 -0400
commit3d74cfca991f4c870b1568954d5e09d390977a44 (patch)
treec175dfb6587bbe681eb0d50d024a592d9a1cd193
parent3f316776bf25160bc5a3f10486456c6ab60ff282 (diff)
downloadhaskell-3d74cfca991f4c870b1568954d5e09d390977a44.tar.gz
Make closure macros EXTERN_INLINE to make debugging easier
Implements #21424. The RTS macros get_itbl and friends are extremely helpful during debugging. However only a select few of those were available in the compiled RTS as actual symbols as the rest were INLINE macros. This commit marks all of them as EXTERN_INLINE. This will still inline them at use sites but allow us to use their compiled counterparts during debugging. This allows us to use things like `p get_fun_itbl(ptr)` in the gdb shell since `get_fun_itbl` will now be available as symbol!
-rw-r--r--rts/include/rts/storage/ClosureMacros.h68
1 files changed, 34 insertions, 34 deletions
diff --git a/rts/include/rts/storage/ClosureMacros.h b/rts/include/rts/storage/ClosureMacros.h
index 2ba84d1279..53bddf2d96 100644
--- a/rts/include/rts/storage/ClosureMacros.h
+++ b/rts/include/rts/storage/ClosureMacros.h
@@ -45,13 +45,13 @@
-------------------------------------------------------------------------- */
-INLINE_HEADER void SET_INFO(StgClosure *c, const StgInfoTable *info) {
+EXTERN_INLINE void SET_INFO(StgClosure *c, const StgInfoTable *info) {
RELAXED_STORE(&c->header.info, info);
}
-INLINE_HEADER void SET_INFO_RELEASE(StgClosure *c, const StgInfoTable *info) {
+EXTERN_INLINE void SET_INFO_RELEASE(StgClosure *c, const StgInfoTable *info) {
RELEASE_STORE(&c->header.info, info);
}
-INLINE_HEADER const StgInfoTable *GET_INFO(StgClosure *c) {
+EXTERN_INLINE const StgInfoTable *GET_INFO(StgClosure *c) {
return RELAXED_LOAD(&c->header.info);
}
@@ -60,25 +60,25 @@ EXTERN_INLINE StgInfoTable *INFO_PTR_TO_STRUCT(const StgInfoTable *info);
EXTERN_INLINE StgInfoTable *INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgInfoTable *)info - 1;}
EXTERN_INLINE StgRetInfoTable *RET_INFO_PTR_TO_STRUCT(const StgInfoTable *info);
EXTERN_INLINE StgRetInfoTable *RET_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgRetInfoTable *)info - 1;}
-INLINE_HEADER StgFunInfoTable *FUN_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgFunInfoTable *)info - 1;}
-INLINE_HEADER StgThunkInfoTable *THUNK_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgThunkInfoTable *)info - 1;}
-INLINE_HEADER StgConInfoTable *CON_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgConInfoTable *)info - 1;}
-INLINE_HEADER StgFunInfoTable *itbl_to_fun_itbl(const StgInfoTable *i) {return (StgFunInfoTable *)(i + 1) - 1;}
-INLINE_HEADER StgRetInfoTable *itbl_to_ret_itbl(const StgInfoTable *i) {return (StgRetInfoTable *)(i + 1) - 1;}
-INLINE_HEADER StgThunkInfoTable *itbl_to_thunk_itbl(const StgInfoTable *i) {return (StgThunkInfoTable *)(i + 1) - 1;}
-INLINE_HEADER StgConInfoTable *itbl_to_con_itbl(const StgInfoTable *i) {return (StgConInfoTable *)(i + 1) - 1;}
+EXTERN_INLINE StgFunInfoTable *FUN_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgFunInfoTable *)info - 1;}
+EXTERN_INLINE StgThunkInfoTable *THUNK_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgThunkInfoTable *)info - 1;}
+EXTERN_INLINE StgConInfoTable *CON_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgConInfoTable *)info - 1;}
+EXTERN_INLINE StgFunInfoTable *itbl_to_fun_itbl(const StgInfoTable *i) {return (StgFunInfoTable *)(i + 1) - 1;}
+EXTERN_INLINE StgRetInfoTable *itbl_to_ret_itbl(const StgInfoTable *i) {return (StgRetInfoTable *)(i + 1) - 1;}
+EXTERN_INLINE StgThunkInfoTable *itbl_to_thunk_itbl(const StgInfoTable *i) {return (StgThunkInfoTable *)(i + 1) - 1;}
+EXTERN_INLINE StgConInfoTable *itbl_to_con_itbl(const StgInfoTable *i) {return (StgConInfoTable *)(i + 1) - 1;}
#else
EXTERN_INLINE StgInfoTable *INFO_PTR_TO_STRUCT(const StgInfoTable *info);
EXTERN_INLINE StgInfoTable *INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgInfoTable *)info;}
EXTERN_INLINE StgRetInfoTable *RET_INFO_PTR_TO_STRUCT(const StgInfoTable *info);
EXTERN_INLINE StgRetInfoTable *RET_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgRetInfoTable *)info;}
-INLINE_HEADER StgFunInfoTable *FUN_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgFunInfoTable *)info;}
-INLINE_HEADER StgThunkInfoTable *THUNK_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgThunkInfoTable *)info;}
-INLINE_HEADER StgConInfoTable *CON_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgConInfoTable *)info;}
-INLINE_HEADER StgFunInfoTable *itbl_to_fun_itbl(const StgInfoTable *i) {return (StgFunInfoTable *)i;}
-INLINE_HEADER StgRetInfoTable *itbl_to_ret_itbl(const StgInfoTable *i) {return (StgRetInfoTable *)i;}
-INLINE_HEADER StgThunkInfoTable *itbl_to_thunk_itbl(const StgInfoTable *i) {return (StgThunkInfoTable *)i;}
-INLINE_HEADER StgConInfoTable *itbl_to_con_itbl(const StgInfoTable *i) {return (StgConInfoTable *)i;}
+EXTERN_INLINE StgFunInfoTable *FUN_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgFunInfoTable *)info;}
+EXTERN_INLINE StgThunkInfoTable *THUNK_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgThunkInfoTable *)info;}
+EXTERN_INLINE StgConInfoTable *CON_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgConInfoTable *)info;}
+EXTERN_INLINE StgFunInfoTable *itbl_to_fun_itbl(const StgInfoTable *i) {return (StgFunInfoTable *)i;}
+EXTERN_INLINE StgRetInfoTable *itbl_to_ret_itbl(const StgInfoTable *i) {return (StgRetInfoTable *)i;}
+EXTERN_INLINE StgThunkInfoTable *itbl_to_thunk_itbl(const StgInfoTable *i) {return (StgThunkInfoTable *)i;}
+EXTERN_INLINE StgConInfoTable *itbl_to_con_itbl(const StgInfoTable *i) {return (StgConInfoTable *)i;}
#endif
EXTERN_INLINE const StgInfoTable *get_itbl(const StgClosure *c);
@@ -93,22 +93,22 @@ EXTERN_INLINE const StgRetInfoTable *get_ret_itbl(const StgClosure *c)
return RET_INFO_PTR_TO_STRUCT(RELAXED_LOAD(&c->header.info));
}
-INLINE_HEADER const StgFunInfoTable *get_fun_itbl(const StgClosure *c)
+EXTERN_INLINE const StgFunInfoTable *get_fun_itbl(const StgClosure *c)
{
return FUN_INFO_PTR_TO_STRUCT(RELAXED_LOAD(&c->header.info));
}
-INLINE_HEADER const StgThunkInfoTable *get_thunk_itbl(const StgClosure *c)
+EXTERN_INLINE const StgThunkInfoTable *get_thunk_itbl(const StgClosure *c)
{
return THUNK_INFO_PTR_TO_STRUCT(RELAXED_LOAD(&c->header.info));
}
-INLINE_HEADER const StgConInfoTable *get_con_itbl(const StgClosure *c)
+EXTERN_INLINE const StgConInfoTable *get_con_itbl(const StgClosure *c)
{
return CON_INFO_PTR_TO_STRUCT(RELAXED_LOAD(&c->header.info));
}
-INLINE_HEADER StgHalfWord GET_TAG(const StgClosure *con)
+EXTERN_INLINE StgHalfWord GET_TAG(const StgClosure *con)
{
return get_itbl(con)->srt;
}
@@ -168,7 +168,7 @@ INLINE_HEADER StgHalfWord GET_TAG(const StgClosure *con)
#define THUNK_STATIC_LINK(p) (&(p)->payload[1])
#define IND_STATIC_LINK(p) (&(p)->payload[1])
-INLINE_HEADER StgClosure **
+EXTERN_INLINE StgClosure **
STATIC_LINK(const StgInfoTable *info, StgClosure *p)
{
switch (info->type) {
@@ -186,10 +186,10 @@ STATIC_LINK(const StgInfoTable *info, StgClosure *p)
INTLIKE and CHARLIKE closures.
-------------------------------------------------------------------------- */
-INLINE_HEADER P_ CHARLIKE_CLOSURE(int n) {
+EXTERN_INLINE P_ CHARLIKE_CLOSURE(int n) {
return (P_)&stg_CHARLIKE_closure[(n)-MIN_CHARLIKE];
}
-INLINE_HEADER P_ INTLIKE_CLOSURE(int n) {
+EXTERN_INLINE P_ INTLIKE_CLOSURE(int n) {
return (P_)&stg_INTLIKE_closure[(n)-MIN_INTLIKE];
}
@@ -198,25 +198,25 @@ INLINE_HEADER P_ INTLIKE_CLOSURE(int n) {
For more information look at the comments in Cmm.h
------------------------------------------------------------------------- */
-static inline StgWord
+EXTERN_INLINE StgWord
GET_CLOSURE_TAG(const StgClosure * p)
{
return (StgWord)p & TAG_MASK;
}
-static inline StgClosure *
+EXTERN_INLINE StgClosure *
UNTAG_CLOSURE(StgClosure * p)
{
return (StgClosure*)((StgWord)p & ~TAG_MASK);
}
-static inline const StgClosure *
+EXTERN_INLINE const StgClosure *
UNTAG_CONST_CLOSURE(const StgClosure * p)
{
return (const StgClosure*)((StgWord)p & ~TAG_MASK);
}
-static inline StgClosure *
+EXTERN_INLINE StgClosure *
TAG_CLOSURE(StgWord tag,StgClosure * p)
{
return (StgClosure*)((StgWord)p | tag);
@@ -247,18 +247,18 @@ TAG_CLOSURE(StgWord tag,StgClosure * p)
make sense...
-------------------------------------------------------------------------- */
-INLINE_HEADER bool LOOKS_LIKE_INFO_PTR_NOT_NULL (StgWord p)
+EXTERN_INLINE bool LOOKS_LIKE_INFO_PTR_NOT_NULL (StgWord p)
{
StgInfoTable *info = INFO_PTR_TO_STRUCT((StgInfoTable *)p);
return info->type != INVALID_OBJECT && info->type < N_CLOSURE_TYPES;
}
-INLINE_HEADER bool LOOKS_LIKE_INFO_PTR (StgWord p)
+EXTERN_INLINE bool LOOKS_LIKE_INFO_PTR (StgWord p)
{
return p && (IS_FORWARDING_PTR(p) || LOOKS_LIKE_INFO_PTR_NOT_NULL(p));
}
-INLINE_HEADER bool LOOKS_LIKE_CLOSURE_PTR (const void *p)
+EXTERN_INLINE bool LOOKS_LIKE_CLOSURE_PTR (const void *p)
{
const StgInfoTable *info = RELAXED_LOAD(&UNTAG_CONST_CLOSURE((const StgClosure *) (p))->header.info);
return LOOKS_LIKE_INFO_PTR((StgWord) info);
@@ -399,20 +399,20 @@ EXTERN_INLINE StgWord stack_frame_sizeW( StgClosure *frame )
-------------------------------------------------------------------------- */
// The number of card bytes needed
-INLINE_HEADER W_ mutArrPtrsCards (W_ elems)
+EXTERN_INLINE W_ mutArrPtrsCards (W_ elems)
{
return (W_)((elems + (1 << MUT_ARR_PTRS_CARD_BITS) - 1)
>> MUT_ARR_PTRS_CARD_BITS);
}
// The number of words in the card table
-INLINE_HEADER W_ mutArrPtrsCardTableSize (W_ elems)
+EXTERN_INLINE W_ mutArrPtrsCardTableSize (W_ elems)
{
return ROUNDUP_BYTES_TO_WDS(mutArrPtrsCards(elems));
}
// The address of the card for a particular card number
-INLINE_HEADER StgWord8 *mutArrPtrsCard (StgMutArrPtrs *a, W_ n)
+EXTERN_INLINE StgWord8 *mutArrPtrsCard (StgMutArrPtrs *a, W_ n)
{
return ((StgWord8 *)&(a->payload[a->ptrs]) + n);
}