Commit 438a757d authored by Heschi Kreinick's avatar Heschi Kreinick

cmd/compile/internal: reuse more memory

Reuse even more memory, and keep track of it in a long-lived debugState
object rather than piecemeal in the Cache.

Change-Id: Ib6936b4e8594dc6dda1f59ece753c00fd1c136ba
Reviewed-on: https://go-review.googlesource.com/92404Reviewed-by: default avatarDavid Chase <drchase@google.com>
parent ac81c5c4
......@@ -572,7 +572,6 @@ var knownFormats = map[string]string{
"*cmd/compile/internal/ssa.Block %v": "",
"*cmd/compile/internal/ssa.Func %s": "",
"*cmd/compile/internal/ssa.Func %v": "",
"*cmd/compile/internal/ssa.LocalSlot %v": "",
"*cmd/compile/internal/ssa.Register %s": "",
"*cmd/compile/internal/ssa.Register %v": "",
"*cmd/compile/internal/ssa.SparseTreeNode %v": "",
......
......@@ -650,7 +650,7 @@ func createComplexVar(fn *Func, varID ssa.VarID) *dwarf.Var {
// variables just give it the first one. It's not used otherwise.
// This won't work well if the first slot hasn't been assigned a stack
// location, but it's not obvious how to do better.
StackOffset: stackOffset(*debug.Slots[debug.VarSlots[varID][0]]),
StackOffset: stackOffset(debug.Slots[debug.VarSlots[varID][0]]),
DeclFile: declpos.RelFilename(),
DeclLine: declpos.RelLine(),
DeclCol: declpos.Col(),
......
......@@ -25,15 +25,7 @@ type Cache struct {
scrSparse []*sparseSet // scratch sparse sets to be re-used.
ValueToProgAfter []*obj.Prog
blockDebug []BlockDebug
valueNames [][]SlotID
slotLocs []VarLoc
regContents [][]SlotID
pendingEntries []pendingEntry
pendingSlotLocs []VarLoc
liveSlotSliceBegin int
liveSlots []liveSlot
debugState debugState
}
func (c *Cache) Reset() {
......@@ -53,16 +45,5 @@ func (c *Cache) Reset() {
xl[i] = nil
}
c.liveSlots = c.liveSlots[:0]
c.liveSlotSliceBegin = 0
}
func (c *Cache) AppendLiveSlot(ls liveSlot) {
c.liveSlots = append(c.liveSlots, ls)
}
func (c *Cache) GetLiveSlotSlice() []liveSlot {
s := c.liveSlots[c.liveSlotSliceBegin:]
c.liveSlotSliceBegin = len(c.liveSlots)
return s
}
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment