• Austin Clements's avatar
    runtime: separate spans of noscan objects · 1a033b1a
    Austin Clements authored
    Currently, we mix objects with pointers and objects without pointers
    ("noscan" objects) together in memory. As a result, for every object
    we grey, we have to check that object's heap bits to find out if it's
    noscan, which adds to the per-object cost of GC. This also hurts the
    TLB footprint of the garbage collector because it decreases the
    density of scannable objects at the page level.
    
    This commit improves the situation by using separate spans for noscan
    objects. This will allow a much simpler noscan check (in a follow up
    CL), eliminate the need to clear the bitmap of noscan objects (in a
    follow up CL), and improves TLB footprint by increasing the density of
    scannable objects.
    
    This is also a step toward eliminating dead bits, since the current
    noscan check depends on checking the dead bit of the first word.
    
    This has no effect on the heap size of the garbage benchmark.
    
    We'll measure the performance change of this after the follow-up
    optimizations.
    
    This is a cherry-pick from dev.garbage commit d491e550. The only
    non-trivial merge conflict was in updatememstats in mstats.go, where
    we now have to separate the per-spanclass stats from the per-sizeclass
    stats.
    
    Change-Id: I13bdc4869538ece5649a8d2a41c6605371618e40
    Reviewed-on: https://go-review.googlesource.com/41251
    Run-TryBot: Austin Clements <austin@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
    1a033b1a
export_test.go 7.51 KB