diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-11-17 09:27:06 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-11-19 11:57:36 -0500 |
commit | c819c0e413069cb4e16236fb3e6576658060a17d (patch) | |
tree | eb193aa80a9f7e704769070e2685cbc918492993 /rts/sm | |
parent | 0418c38d55c7a47967187dce2db5ea2ab1021b1e (diff) | |
download | haskell-c819c0e413069cb4e16236fb3e6576658060a17d.tar.gz |
nonmoving: Use correct info table pointer accessor
Previously we used INFO_PTR_TO_STRUCT instead of
THUNK_INFO_PTR_TO_STRUCT when looking at a thunk. These two happen to be
equivalent on 64-bit architectures due to alignment considerations
however they are different on 32-bit platforms. This lead to #17487.
To fix this we also employ a small optimization: there is only one thunk
of type WHITEHOLE (namely stg_WHITEHOLE_info). Consequently, we can just
use a plain pointer comparison instead of testing against info->type.
Diffstat (limited to 'rts/sm')
-rw-r--r-- | rts/sm/NonMovingMark.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/rts/sm/NonMovingMark.c b/rts/sm/NonMovingMark.c index b7ab772bdd..e236056092 100644 --- a/rts/sm/NonMovingMark.c +++ b/rts/sm/NonMovingMark.c @@ -567,9 +567,11 @@ inline void updateRemembSetPushThunk(Capability *cap, StgThunk *thunk) { const StgInfoTable *info; do { - info = get_volatile_itbl((StgClosure *) thunk); - } while (info->type == WHITEHOLE); - updateRemembSetPushThunkEager(cap, (StgThunkInfoTable *) info, thunk); + info = *(StgInfoTable* volatile*) &thunk->header.info; + } while (info == &stg_WHITEHOLE_info); + + const StgThunkInfoTable *thunk_info = THUNK_INFO_PTR_TO_STRUCT(info); + updateRemembSetPushThunkEager(cap, thunk_info, thunk); } /* Push the free variables of a thunk to the update remembered set. @@ -1229,7 +1231,7 @@ mark_closure (MarkQueue *queue, const StgClosure *p0, StgClosure **origin) goto done; case WHITEHOLE: - while (get_volatile_itbl(p)->type == WHITEHOLE); + while (*(StgInfoTable* volatile*) &p->header.info == &stg_WHITEHOLE_info); // busy_wait_nop(); // FIXME goto try_again; @@ -1588,7 +1590,7 @@ mark_closure (MarkQueue *queue, const StgClosure *p0, StgClosure **origin) } case WHITEHOLE: - while (get_volatile_itbl(p)->type == WHITEHOLE); + while (*(StgInfoTable* volatile*) &p->header.info == &stg_WHITEHOLE_info); goto try_again; case COMPACT_NFDATA: |