• Josh Bleecher Snyder's avatar
    cmd/compile: rearrange fields between ssa.Func, ssa.Cache, and ssa.Config · a5e3cac8
    Josh Bleecher Snyder authored
    This makes ssa.Func, ssa.Cache, and ssa.Config fulfill
    the roles laid out for them in CL 38160.
    
    The only non-trivial change in this CL is how cached
    values and blocks get IDs. Prior to this CL, their IDs were
    assigned as part of resetting the cache, and only modified
    IDs were reset. This required knowing how many values and
    blocks were modified, which required a tight coupling between
    ssa.Func and ssa.Config. To eliminate that coupling,
    we now zero values and blocks during reset,
    and assign their IDs when they are used.
    Since unused values and blocks have ID == 0,
    we can efficiently find the last used value/block,
    to avoid zeroing everything.
    Bulk zeroing is efficient, but not efficient enough
    to obviate the need to avoid zeroing everything every time.
    As a happy side-effect, ssa.Func.Free is no longer necessary.
    
    DebugHashMatch and friends now belong in func.go.
    They have been left in place for clarity and review.
    I will move them in a subsequent CL.
    
    Passes toolstash -cmp. No compiler performance impact.
    No change in 'go test cmd/compile/internal/ssa' execution time.
    
    Change-Id: I2eb7af58da067ef6a36e815a6f386cfe8634d098
    Reviewed-on: https://go-review.googlesource.com/38167
    Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarKeith Randall <khr@golang.org>
    a5e3cac8
dom.go 8.14 KB