• 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
..
archive Loading commit data...
bufio Loading commit data...
builtin Loading commit data...
bytes Loading commit data...
cmd Loading commit data...
compress Loading commit data...
container Loading commit data...
crypto Loading commit data...
database/sql Loading commit data...
debug Loading commit data...
encoding Loading commit data...
errors Loading commit data...
expvar Loading commit data...
flag Loading commit data...
fmt Loading commit data...
go Loading commit data...
hash Loading commit data...
html Loading commit data...
image Loading commit data...
index/suffixarray Loading commit data...
internal Loading commit data...
io Loading commit data...
log Loading commit data...
math Loading commit data...
mime Loading commit data...
net Loading commit data...
os Loading commit data...
path Loading commit data...
reflect Loading commit data...
regexp Loading commit data...
runtime Loading commit data...
sort Loading commit data...
strconv Loading commit data...
strings Loading commit data...
sync Loading commit data...
syscall Loading commit data...
testing Loading commit data...
text Loading commit data...
time Loading commit data...
unicode Loading commit data...
unsafe Loading commit data...
vendor/golang.org/x/net/http2/hpack Loading commit data...
Make.dist Loading commit data...
all.bash Loading commit data...
all.bat Loading commit data...
all.rc Loading commit data...
androidtest.bash Loading commit data...
bootstrap.bash Loading commit data...
buildall.bash Loading commit data...
clean.bash Loading commit data...
clean.bat Loading commit data...
clean.rc Loading commit data...
iostest.bash Loading commit data...
make.bash Loading commit data...
make.bat Loading commit data...
make.rc Loading commit data...
nacltest.bash Loading commit data...
race.bash Loading commit data...
race.bat Loading commit data...
run.bash Loading commit data...
run.bat Loading commit data...
run.rc Loading commit data...