Eliminate zero_static_objects_list()

Authored by simonmar.


Eliminate zero_static_objects_list()

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, bgamari, ezyang, rwbarton

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1076

This causes a 6.36% runtime regression for fannkuch-redux, but improves others. The regression is partly, but not fully, amended by the next commit (Two step allocator for 64-bit systems):

Probably no need to worry, so this is just for the record.

bgamari raised a concern with this commit.Jul 24 2015, 10:37 AM
bgamari added a subscriber: bgamari.

This unfortunately appears to segfault when building ghc with BuildFlavour=prof. Still investigating why.

bgamari accepted this commit.Jul 24 2015, 10:45 AM

Fixed by 09d05050346c1be7bac20ba3f40861e05217368b

@bgamari: thanks for the fix and sorry for the breakage!
@nomeata I'll definitely look into that, thanks for the heads up.