Eliminate zero_static_objects_list()

Authored by simonmar.

Description

Eliminate zero_static_objects_list()

Summary:
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):
https://perf.haskell.org/ghc/#graph/nofib/time/fannkuch-redux;hl=b949c96b4960168a3b399fe14485b24a2167b982

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: thanks for the fix and sorry for the breakage!
@nomeata I'll definitely look into that, thanks for the heads up.