mirror of
https://github.com/golang/go
synced 2024-11-26 08:07:57 -07:00
cmd/compile: make stack value size threshold comparisons consistent
Consistency is beautiful.
Change-Id: Ib110dcff0ce2fa87b5576c79cd79c83aab385a7c
GitHub-Last-Rev: b8758f8ae0
GitHub-Pull-Request: golang/go#47011
Reviewed-on: https://go-review.googlesource.com/c/go/+/332230
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
parent
9d65578b83
commit
eb437ba92c
@ -2013,14 +2013,14 @@ func HeapAllocReason(n ir.Node) string {
|
||||
return "too large for stack"
|
||||
}
|
||||
|
||||
if (n.Op() == ir.ONEW || n.Op() == ir.OPTRLIT) && n.Type().Elem().Width >= ir.MaxImplicitStackVarSize {
|
||||
if (n.Op() == ir.ONEW || n.Op() == ir.OPTRLIT) && n.Type().Elem().Width > ir.MaxImplicitStackVarSize {
|
||||
return "too large for stack"
|
||||
}
|
||||
|
||||
if n.Op() == ir.OCLOSURE && typecheck.ClosureType(n.(*ir.ClosureExpr)).Size() >= ir.MaxImplicitStackVarSize {
|
||||
if n.Op() == ir.OCLOSURE && typecheck.ClosureType(n.(*ir.ClosureExpr)).Size() > ir.MaxImplicitStackVarSize {
|
||||
return "too large for stack"
|
||||
}
|
||||
if n.Op() == ir.OCALLPART && typecheck.PartialCallType(n.(*ir.SelectorExpr)).Size() >= ir.MaxImplicitStackVarSize {
|
||||
if n.Op() == ir.OCALLPART && typecheck.PartialCallType(n.(*ir.SelectorExpr)).Size() > ir.MaxImplicitStackVarSize {
|
||||
return "too large for stack"
|
||||
}
|
||||
|
||||
@ -2033,7 +2033,7 @@ func HeapAllocReason(n ir.Node) string {
|
||||
if !ir.IsSmallIntConst(r) {
|
||||
return "non-constant size"
|
||||
}
|
||||
if t := n.Type(); t.Elem().Width != 0 && ir.Int64Val(r) >= ir.MaxImplicitStackVarSize/t.Elem().Width {
|
||||
if t := n.Type(); t.Elem().Width != 0 && ir.Int64Val(r) > ir.MaxImplicitStackVarSize/t.Elem().Width {
|
||||
return "too large for stack"
|
||||
}
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ func walkNew(n *ir.UnaryExpr, init *ir.Nodes) ir.Node {
|
||||
base.Errorf("%v can't be allocated in Go; it is incomplete (or unallocatable)", n.Type().Elem())
|
||||
}
|
||||
if n.Esc() == ir.EscNone {
|
||||
if t.Size() >= ir.MaxImplicitStackVarSize {
|
||||
if t.Size() > ir.MaxImplicitStackVarSize {
|
||||
base.Fatalf("large ONEW with EscNone: %v", n)
|
||||
}
|
||||
return stackTempAddr(init, t)
|
||||
|
Loading…
Reference in New Issue
Block a user