state.varParts[topSlot.N] = append(state.varParts[topSlot.N], SlotID(i))
}
+ // Recreate the LocalSlot for each stack-only variable.
+ // This would probably be better as an output from stackframe.
+ for _, b := range f.Blocks {
+ for _, v := range b.Values {
+ if v.Op == OpVarDef || v.Op == OpVarKill {
+ n := v.Aux.(GCNode)
+ if n.IsSynthetic() {
+ continue
+ }
+
+ if _, ok := state.varParts[n]; !ok {
+ slot := LocalSlot{N: n, Type: v.Type, Off: 0}
+ state.slots = append(state.slots, slot)
+ state.varParts[n] = []SlotID{SlotID(len(state.slots) - 1)}
+ state.vars = append(state.vars, n)
+ }
+ }
+ }
+ }
+
// Fill in the var<->slot mappings.
if cap(state.varSlots) < len(state.vars) {
state.varSlots = make([][]SlotID, len(state.vars))
}
switch {
+ case v.Op == OpVarDef, v.Op == OpVarKill:
+ n := v.Aux.(GCNode)
+ if n.IsSynthetic() {
+ break
+ }
+
+ slotID := state.varParts[n][0]
+ var stackOffset StackOffset
+ if v.Op == OpVarDef {
+ stackOffset = StackOffset(state.stackOffset(state.slots[slotID])<<1 | 1)
+ }
+ setSlot(slotID, VarLoc{0, stackOffset})
+ if state.loggingEnabled {
+ if v.Op == OpVarDef {
+ state.logf("at %v: stack-only var %v now live\n", v.ID, state.slots[slotID])
+ } else {
+ state.logf("at %v: stack-only var %v now dead\n", v.ID, state.slots[slotID])
+ }
+ }
+
case v.Op == OpArg:
home := state.f.getHome(v.ID).(LocalSlot)
stackOffset := state.stackOffset(home)<<1 | 1
state.writePendingEntry(VarID(varID), state.f.Blocks[len(state.f.Blocks)-1].ID, BlockEnd.ID)
list := state.lists[varID]
if len(list) == 0 {
- continue
+ state.logf("\t%v : empty list\n", state.vars[varID])
}
if state.loggingEnabled {