]> Cypherpunks repositories - gostls13.git/commit
[dev.garbage] runtime: use sys.Ctz64 intrinsic
authorRick Hudson <rlh@golang.org>
Thu, 31 Mar 2016 14:45:36 +0000 (10:45 -0400)
committerRick Hudson <rlh@golang.org>
Fri, 29 Apr 2016 00:00:50 +0000 (00:00 +0000)
commit2fb75ea6c65d03c3fda89c8e954712a2fa97b052
tree0a935654350567677df570f8ad673f621dabc658
parent2063d5d903718962de58a86a692626fe89919a4d
[dev.garbage] runtime: use sys.Ctz64 intrinsic

Our compilers now provides instrinsics including
sys.Ctz64 that support CTZ (count trailing zero)
instructions. This CL replaces the Go versions
of CTZ with the compiler intrinsic.

Count trailing zeros CTZ finds the least
significant 1 in a word and returns the number
of less significant 0s in the word.

Allocation uses the bitmap created by the garbage
collector to locate an unmarked object. The logic
takes a word of the bitmap, complements, and then
caches it. It then uses CTZ to locate an available
unmarked object. It then shifts marked bits out of
the bitmap word preparing it for the next search.
Once all the unmarked objects are used in the
cached work the bitmap gets another word and
repeats the process.

Change-Id: Id2fc42d1d4b9893efaa2e1bd01896985b7e42f82
Reviewed-on: https://go-review.googlesource.com/21366
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/malloc.go
src/runtime/mbitmap.go
src/runtime/mheap.go