• Rick Hudson's avatar
    [dev.garbage] runtime: use sys.Ctz64 intrinsic · 2fb75ea6
    Rick Hudson authored
    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/21366Reviewed-by: 's avatarAustin Clements <austin@google.com>
    2fb75ea6
mbitmap.go 65.1 KB