mirror of
https://github.com/golang/go
synced 2024-11-19 15:44:44 -07:00
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: David Chase <drchase@google.com>
This commit is contained in:
parent
7ac756f74b
commit
b8644e3243
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user