diff options
author | Simon Marlow <marlowsd@gmail.com> | 2018-04-22 14:28:47 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2018-05-16 13:36:13 +0100 |
commit | 2b0918c9834be1873728176e4944bec26271234a (patch) | |
tree | f47689b64d3339c9cd92ad286fe01db478b53550 /rts | |
parent | fbd28e2c6b5f1302cd2d36d79149e3b0a9f01d84 (diff) | |
download | haskell-2b0918c9834be1873728176e4944bec26271234a.tar.gz |
Save a word in the info table on x86_64
Summary:
An info table with an SRT normally looks like this:
StgWord64 srt_offset
StgClosureInfo layout
StgWord32 layout
StgWord32 has_srt
But we only need 32 bits for srt_offset on x86_64, because the small
memory model requires that code segments are at most 2GB. So we can
optimise this to
StgClosureInfo layout
StgWord32 layout
StgWord32 srt_offset
saving a word. We can tell whether the info table has an SRT or not,
because zero is not a valid srt_offset, so zero still indicates that
there's no SRT.
Test Plan:
* validate
* For results, see D4632.
Reviewers: bgamari, niteria, osa1, erikd
Subscribers: thomie, carter
Differential Revision: https://phabricator.haskell.org/D4634
Diffstat (limited to 'rts')
-rw-r--r-- | rts/RtsAPI.c | 2 | ||||
-rw-r--r-- | rts/sm/Evac.c | 4 | ||||
-rw-r--r-- | rts/sm/Scav.c | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/rts/RtsAPI.c b/rts/RtsAPI.c index 8946f9d840..8fd1917392 100644 --- a/rts/RtsAPI.c +++ b/rts/RtsAPI.c @@ -367,7 +367,7 @@ rts_getBool (HaskellObj p) const StgInfoTable *info; info = get_itbl((const StgClosure *)UNTAG_CONST_CLOSURE(p)); - if (info->has_srt == 0) { // has_srt is the constructor tag + if (info->srt == 0) { // srt is the constructor tag return 0; } else { return 1; diff --git a/rts/sm/Evac.c b/rts/sm/Evac.c index 198c37d5a9..a8559e7e00 100644 --- a/rts/sm/Evac.c +++ b/rts/sm/Evac.c @@ -536,13 +536,13 @@ loop: switch (info->type) { case THUNK_STATIC: - if (info->has_srt != 0) { + if (info->srt != 0) { evacuate_static_object(THUNK_STATIC_LINK((StgClosure *)q), q); } return; case FUN_STATIC: - if (info->has_srt != 0) { + if (info->srt != 0) { evacuate_static_object(FUN_STATIC_LINK((StgClosure *)q), q); } return; diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c index 1bee05221a..79adcaa826 100644 --- a/rts/sm/Scav.c +++ b/rts/sm/Scav.c @@ -337,7 +337,7 @@ scavenge_thunk_srt(const StgInfoTable *info) if (!major_gc) return; thunk_info = itbl_to_thunk_itbl(info); - if (thunk_info->i.has_srt) { + if (thunk_info->i.srt) { StgClosure *srt = (StgClosure*)GET_SRT(thunk_info); evacuate(&srt); } @@ -351,7 +351,7 @@ scavenge_fun_srt(const StgInfoTable *info) if (!major_gc) return; fun_info = itbl_to_fun_itbl(info); - if (fun_info->i.has_srt) { + if (fun_info->i.srt) { StgClosure *srt = (StgClosure*)GET_FUN_SRT(fun_info); evacuate(&srt); } @@ -1888,7 +1888,7 @@ scavenge_stack(StgPtr p, StgPtr stack_end) p = scavenge_small_bitmap(p, size, bitmap); follow_srt: - if (major_gc && info->i.has_srt) { + if (major_gc && info->i.srt) { StgClosure *srt = (StgClosure*)GET_SRT(info); evacuate(&srt); } |