• Heschi Kreinick's avatar
    cmd/compile: use correct stack slots in location lists · 0b6b5641
    Heschi Kreinick authored
    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/67231Reviewed-by: 's avatarAlessandro Arzilli <alessandro.arzilli@gmail.com>
    Reviewed-by: 's avatarDavid Chase <drchase@google.com>
    0b6b5641
pgen.go 20.2 KB