]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: use correct stack slots in location lists
authorHeschi Kreinick <heschi@google.com>
Fri, 29 Sep 2017 18:14:03 +0000 (14:14 -0400)
committerHeschi Kreinick <heschi@google.com>
Tue, 3 Oct 2017 19:19:46 +0000 (19:19 +0000)
commit0b6b5641d7f30cc1cf6ec623793ec758861359dc
tree88ac75b128f43d4e42cb7c1597017bbebf345ce7
parentca8c361d867d62bd46013c5abbaaad0b2ca6077f
cmd/compile: use correct stack slots in location lists

When variables need to be spilled to the stack, they usually get their
own stack slot. Local variables have a slot allocated if they need one,
and arguments start out on the stack. Before this CL, the debug
information made the assumption that this was always the case, and so
didn't bother storing an actual stack offset during SSA analysis.

There's at least one case where this isn't true: variables that alias
arguments. Since the argument is the source of the variable, the
variable will begin its life on the stack in the argument's stack slot,
not its own. Therefore the debug info needs to track the actual stack
slot for each location entry.

No detectable performance change, despite the O(N) loop in getHomeSlot.

Change-Id: I2701adb7eddee17d4524336cb7aa6786e8f32b46
Reviewed-on: https://go-review.googlesource.com/67231
Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/gc/pgen.go
src/cmd/compile/internal/ssa/debug.go