• Keith Randall's avatar
    cmd/compile: better job of naming compound types · 4a7aba77
    Keith Randall authored
    Compound AUTO types weren't named previously.  That was because live
    variable analysis (plive.go) doesn't handle spilling to compound types.
    It can't handle them because there is no valid place to put VARDEFs when
    regalloc is spilling compound types.
    
    compound types = multiword builtin types: complex, string, slice, and
    interface.
    
    Instead, we split named AUTOs into individual one-word variables.  For
    example, a string s gets split into a byte ptr s.ptr and an integer
    s.len.  Those two variables can be spilled to / restored from
    independently.  As a result, live variable analysis can handle them
    because they are one-word objects.
    
    This CL will change how AUTOs are described in DWARF information.
    Consider the code:
    
    func f(s string, i int) int {
        x := s[i:i+5]
        g()
        return lookup(x)
    }
    
    The old compiler would spill x to two consecutive slots on the stack,
    both named x (at offsets 0 and 8).  The new compiler spills the pointer
    of x to a slot named x.ptr.  It doesn't spill x.len at all, as it is a
    constant (5) and can be rematerialized for the call to lookup.
    
    So compound objects may not be spilled in their entirety, and even if
    they are they won't necessarily be contiguous.  Such is the price of
    optimization.
    
    Re-enable live variable analysis tests.  One test remains disabled, it
    fails because of #14904.
    
    Change-Id: I8ef2b5ab91e43a0d2136bfc231c05d100ec0b801
    Reviewed-on: https://go-review.googlesource.com/21233
    Run-TryBot: Keith Randall <khr@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarDavid Chase <drchase@google.com>
    4a7aba77
Name
Last commit
Last update
..
addr2line Loading commit data...
api Loading commit data...
asm Loading commit data...
cgo Loading commit data...
compile Loading commit data...
cover Loading commit data...
dist Loading commit data...
doc Loading commit data...
fix Loading commit data...
go Loading commit data...
gofmt Loading commit data...
internal Loading commit data...
link Loading commit data...
nm Loading commit data...
objdump Loading commit data...
pack Loading commit data...
pprof Loading commit data...
trace Loading commit data...
vet Loading commit data...
yacc Loading commit data...