diff options
author | Simon Marlow <marlowsd@gmail.com> | 2015-07-28 20:58:25 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2015-07-28 20:58:35 +0100 |
commit | f83aab95f59ae9b29f22fc7924e050512229cb9c (patch) | |
tree | 2f03ed82c7122f373da774148e3c806aa1dbcae8 /rts/sm/Scav.c | |
parent | a1dd7dd6ea276832aef0caaf805f0ab9f4e16262 (diff) | |
download | haskell-f83aab95f59ae9b29f22fc7924e050512229cb9c.tar.gz |
Eliminate zero_static_objects_list()
Summary:
[Revised version of D1076 that was committed and then backed out]
In a workload with a large amount of code, zero_static_objects_list()
takes a significant amount of time, and furthermore it is in the
single-threaded part of the GC.
This patch uses a slightly fiddly scheme for marking objects on the
static object lists, using a flag in the low 2 bits that flips between
two states to indicate whether an object has been visited during this
GC or not. We also have to take into account objects that have not
been visited yet, which might appear at any time due to runtime linking.
Test Plan: validate
Reviewers: austin, ezyang, rwbarton, bgamari, thomie
Reviewed By: bgamari, thomie
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1106
Diffstat (limited to 'rts/sm/Scav.c')
-rw-r--r-- | rts/sm/Scav.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c index a8f0ab037f..dfad0bef58 100644 --- a/rts/sm/Scav.c +++ b/rts/sm/Scav.c @@ -1672,7 +1672,7 @@ scavenge_capability_mut_lists (Capability *cap) static void scavenge_static(void) { - StgClosure* p; + StgClosure *flagged_p, *p; const StgInfoTable *info; debugTrace(DEBUG_gc, "scavenging static objects"); @@ -1690,10 +1690,11 @@ scavenge_static(void) * be more stuff on this list after each evacuation... * (static_objects is a global) */ - p = gct->static_objects; - if (p == END_OF_STATIC_LIST) { + flagged_p = gct->static_objects; + if (flagged_p == END_OF_STATIC_OBJECT_LIST) { break; } + p = UNTAG_STATIC_LIST_PTR(flagged_p); ASSERT(LOOKS_LIKE_CLOSURE_PTR(p)); info = get_itbl(p); @@ -1708,7 +1709,7 @@ scavenge_static(void) */ gct->static_objects = *STATIC_LINK(info,p); *STATIC_LINK(info,p) = gct->scavenged_static_objects; - gct->scavenged_static_objects = p; + gct->scavenged_static_objects = flagged_p; switch (info -> type) { @@ -2066,7 +2067,7 @@ loop: work_to_do = rtsFalse; // scavenge static objects - if (major_gc && gct->static_objects != END_OF_STATIC_LIST) { + if (major_gc && gct->static_objects != END_OF_STATIC_OBJECT_LIST) { IF_DEBUG(sanity, checkStaticObjects(gct->static_objects)); scavenge_static(); } |