runtime: implement the spanSet data structure
runtime: implement the spanSet data structure

This change implements the spanSet data structure which is based off of
the gcSweepBuf data structure. While the general idea is the same (one
has two of these which one switches between every GC cycle; one to push
to and one to pop from), there are some key differences.

Firstly, we never have a need to iterate over this data structure so
delete numBlocks and block. Secondly, we want to be able to pop from the
front of the structure concurrently with pushes to the back. As a result
we need to maintain both a head and a tail and this change introduces an
atomic headTail structure similar to the one used by sync.Pool. It also
implements popfirst in a similar way.

As a result of this headTail, we need to be able to explicitly reset the
length, head, and tail when it goes empty at the end of sweep
termination, so add a reset method.

Updates #37487.

Change-Id: I5b8ad290ec32d591e3c8c05e496c5627018074f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/221181
Run-TryBot: Michael Knyszek <4473450dc5c88f06e1fb787f303d7805ec2aee65@google.com>
TryBot-Result: Gobot Gobot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Reviewed-by: Austin Clements <7ea35d812706d9213868749011af1ed4fa2f6aa0@google.com>

CAFxX/go,akutz/go,nawawi/go,golang/go,CAFxX/go,golang/go,CAFxX/go,akutz/go,CAFxX/go,cloudflare/go,nawawi/go,cloudflare/go,cloudflare/go,nawawi/go,golang/go,golang/go,cloudflare/go,cloudflare/go,akutz/go,golang/go,CAFxX/go,golang/go,akutz/go,nawawi/go,cloudflare/go,CAFxX/go,CAFxX/go,nawawi/go,akutz/go,golang/go,akutz/go,nawawi/go,CAFxX/go,cloudflare/go,nawawi/go,akutz/go,akutz/go,nawawi/go,golang/go,cloudflare/go