libgo: build roots index to speed up bulkBarrierPreWrite

To reduce the amount of time spent in write barrier processing
(specifically runtime.bulkBarrierPreWrite), add support for building a
'GC roots index', basically a sorted list of all roots, so as to
allow more efficient lookups of gcdata structures for globals. The
previous implementation worked on the raw (unsorted) roots list
itself, which did not scale well.

Change-Id: I2cc0519abea7f9f6b98188cfaab48e4abfe57d06
Reviewed-on: https://go-review.googlesource.com/132595
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 files changed