mirror of
https://github.com/golang/go.git
synced 2025-05-05 23:53:05 +00:00
[dev.ssa] cmd/compile: Use varkill only for non-SSAable vars
For variables which get SSA'd, SSA keeps track of all the def/kill. It is only for on-stack variables that we need them. This reduces stack frame sizes significantly because often the only use of a variable was a varkill, and without that last use the variable doesn't get allocated in the frame at all. Fixes #12602 Change-Id: I3f00a768aa5ddd8d7772f375b25f846086a3e689 Reviewed-on: https://go-review.googlesource.com/14758 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
37590bddc4
commit
d29e92be52
@ -794,7 +794,9 @@ func (s *state) stmt(n *Node) {
|
|||||||
// We only care about liveness info at call sites, so putting the
|
// We only care about liveness info at call sites, so putting the
|
||||||
// varkill in the store chain is enough to keep it correctly ordered
|
// varkill in the store chain is enough to keep it correctly ordered
|
||||||
// with respect to call ops.
|
// with respect to call ops.
|
||||||
s.vars[&memVar] = s.newValue1A(ssa.OpVarKill, ssa.TypeMem, n.Left, s.mem())
|
if !canSSA(n.Left) {
|
||||||
|
s.vars[&memVar] = s.newValue1A(ssa.OpVarKill, ssa.TypeMem, n.Left, s.mem())
|
||||||
|
}
|
||||||
|
|
||||||
case OCHECKNIL:
|
case OCHECKNIL:
|
||||||
p := s.expr(n.Left)
|
p := s.expr(n.Left)
|
||||||
|
@ -41,7 +41,7 @@ const (
|
|||||||
STACKSYSTEM = 0
|
STACKSYSTEM = 0
|
||||||
StackSystem = STACKSYSTEM
|
StackSystem = STACKSYSTEM
|
||||||
StackBig = 4096
|
StackBig = 4096
|
||||||
StackGuard = 960*stackGuardMultiplier + StackSystem
|
StackGuard = 640*stackGuardMultiplier + StackSystem
|
||||||
StackSmall = 128
|
StackSmall = 128
|
||||||
StackLimit = StackGuard - StackSystem - StackSmall
|
StackLimit = StackGuard - StackSystem - StackSmall
|
||||||
)
|
)
|
||||||
|
@ -86,7 +86,7 @@ const (
|
|||||||
|
|
||||||
// The stack guard is a pointer this many bytes above the
|
// The stack guard is a pointer this many bytes above the
|
||||||
// bottom of the stack.
|
// bottom of the stack.
|
||||||
_StackGuard = 960*stackGuardMultiplier + _StackSystem
|
_StackGuard = 640*stackGuardMultiplier + _StackSystem
|
||||||
|
|
||||||
// After a stack split check the SP is allowed to be this
|
// After a stack split check the SP is allowed to be this
|
||||||
// many bytes below the stack guard. This saves an instruction
|
// many bytes below the stack guard. This saves an instruction
|
||||||
|
@ -285,12 +285,12 @@ TestCases:
|
|||||||
// Instead of rewriting the test cases above, adjust
|
// Instead of rewriting the test cases above, adjust
|
||||||
// the first stack frame to use up the extra bytes.
|
// the first stack frame to use up the extra bytes.
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
size += 832 - 128
|
size += 512 - 128
|
||||||
// Noopt builds have a larger stackguard.
|
// Noopt builds have a larger stackguard.
|
||||||
// See ../cmd/dist/buildruntime.go:stackGuardMultiplier
|
// See ../cmd/dist/buildruntime.go:stackGuardMultiplier
|
||||||
for _, s := range strings.Split(os.Getenv("GO_GCFLAGS"), " ") {
|
for _, s := range strings.Split(os.Getenv("GO_GCFLAGS"), " ") {
|
||||||
if s == "-N" {
|
if s == "-N" {
|
||||||
size += 960
|
size += 640
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user