diff options
author | Simon Marlow <marlowsd@gmail.com> | 2018-04-22 19:34:32 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2018-05-16 13:36:13 +0100 |
commit | 838b69032566ce6ab3918d70e8d5e098d0bcee02 (patch) | |
tree | ac764fcb2dc421a13fd76fec1a1d6d01fd0b4f1c /rts/sm | |
parent | 2b0918c9834be1873728176e4944bec26271234a (diff) | |
download | haskell-838b69032566ce6ab3918d70e8d5e098d0bcee02.tar.gz |
Merge FUN_STATIC closure with its SRT
Summary:
The idea here is to save a little code size and some work in the GC,
by collapsing FUN_STATIC closures and their SRTs.
This is (4) in a series; see D4632 for more details.
There's a tradeoff here: more complexity in the compiler in exchange
for a modest code size reduction (probably around 0.5%).
Results:
* GHC binary itself (statically linked) is 1% smaller
* -0.2% binary sizes in nofib (-0.5% module sizes)
Full nofib results comparing D4634 with this: P177 (ignore runtimes,
these aren't stable on my laptop)
Test Plan: validate, nofib
Reviewers: bgamari, niteria, simonpj, erikd
Subscribers: thomie, carter
Differential Revision: https://phabricator.haskell.org/D4637
Diffstat (limited to 'rts/sm')
-rw-r--r-- | rts/sm/Compact.c | 2 | ||||
-rw-r--r-- | rts/sm/Evac.c | 4 | ||||
-rw-r--r-- | rts/sm/Sanity.c | 2 | ||||
-rw-r--r-- | rts/sm/Scav.c | 4 |
4 files changed, 7 insertions, 5 deletions
diff --git a/rts/sm/Compact.c b/rts/sm/Compact.c index 0e2fea8990..f252e89161 100644 --- a/rts/sm/Compact.c +++ b/rts/sm/Compact.c @@ -212,7 +212,7 @@ thread_static( StgClosure* p ) p = *THUNK_STATIC_LINK(p); continue; case FUN_STATIC: - p = *FUN_STATIC_LINK(p); + p = *STATIC_LINK(info,p); continue; case CONSTR: case CONSTR_NOCAF: diff --git a/rts/sm/Evac.c b/rts/sm/Evac.c index a8559e7e00..e8baebe553 100644 --- a/rts/sm/Evac.c +++ b/rts/sm/Evac.c @@ -542,8 +542,8 @@ loop: return; case FUN_STATIC: - if (info->srt != 0) { - evacuate_static_object(FUN_STATIC_LINK((StgClosure *)q), q); + if (info->srt != 0 || info->layout.payload.ptrs != 0) { + evacuate_static_object(STATIC_LINK(info,(StgClosure *)q), q); } return; diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c index 7a0ad1672f..defefa3f01 100644 --- a/rts/sm/Sanity.c +++ b/rts/sm/Sanity.c @@ -677,7 +677,7 @@ checkStaticObjects ( StgClosure* static_objects ) break; case FUN_STATIC: - p = *FUN_STATIC_LINK((StgClosure *)p); + p = *STATIC_LINK(info,(StgClosure *)p); break; case CONSTR: diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c index 79adcaa826..5db0acbbee 100644 --- a/rts/sm/Scav.c +++ b/rts/sm/Scav.c @@ -1722,7 +1722,9 @@ scavenge_static(void) case FUN_STATIC: scavenge_fun_srt(info); - break; + // fallthrough: a FUN_STATIC can also be an SRT, so it may have pointer + // fields. See Note [SRTs] in CmmBuildInfoTables, specifically the [FUN] + // optimisation. case CONSTR: case CONSTR_NOCAF: |