Commit b8644e32 authored by Heschi Kreinick's avatar Heschi Kreinick

cmd/compile/internal: reuse memory for valueToProgAfter

Not a big improvement, but does help edge cases like the SSA package.
Change-Id: I40e531110b97efd5f45955be477fd0f4faa8d545
Reviewed-on: https://go-review.googlesource.com/92396
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarDavid Chase <drchase@google.com>
parent 7ac756f7
......@@ -4653,7 +4653,13 @@ func genssa(f *ssa.Func, pp *Progs) {
s.ScratchFpMem = e.scratchFpMem
if Ctxt.Flag_locationlists {
valueToProgAfter = make([]*obj.Prog, f.NumValues())
if cap(f.Cache.ValueToProgAfter) < f.NumValues() {
f.Cache.ValueToProgAfter = make([]*obj.Prog, f.NumValues())
}
valueToProgAfter = f.Cache.ValueToProgAfter[:f.NumValues()]
for i := range valueToProgAfter {
valueToProgAfter[i] = nil
}
}
// Emit basic blocks
......
......@@ -4,7 +4,10 @@
package ssa
import "sort"
import (
"cmd/internal/obj"
"sort"
)
// A Cache holds reusable compiler state.
// It is intended to be re-used for multiple Func compilations.
......@@ -21,12 +24,13 @@ type Cache struct {
domblockstore []ID // scratch space for computing dominators
scrSparse []*sparseSet // scratch sparse sets to be re-used.
blockDebug []BlockDebug
valueNames [][]SlotID
slotLocs []VarLoc
regContents [][]SlotID
pendingEntries []pendingEntry
pendingSlotLocs []VarLoc
ValueToProgAfter []*obj.Prog
blockDebug []BlockDebug
valueNames [][]SlotID
slotLocs []VarLoc
regContents [][]SlotID
pendingEntries []pendingEntry
pendingSlotLocs []VarLoc
liveSlotSliceBegin int
liveSlots []liveSlot
......
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