mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: large ptr literals must escape
They get rewritten to NEWs, and they must be marked as escaping so walk doesn't try to allocate them back onto the stack. Fixes #15733 Change-Id: I433033e737c3de51a9e83a5a273168dbc9110b74 Reviewed-on: https://go-review.googlesource.com/23223 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
parent
1ab9428eec
commit
d603c27c6b
2 changed files with 24 additions and 1 deletions
|
|
@ -640,7 +640,7 @@ func esc(e *EscState, n *Node, up *Node) {
|
|||
// "Big" conditions that were scattered around in walk have been gathered here
|
||||
if n.Esc != EscHeap && n.Type != nil &&
|
||||
(n.Type.Width > MaxStackVarSize ||
|
||||
n.Op == ONEW && n.Type.Elem().Width >= 1<<16 ||
|
||||
(n.Op == ONEW || n.Op == OPTRLIT) && n.Type.Elem().Width >= 1<<16 ||
|
||||
n.Op == OMAKESLICE && !isSmallMakeSlice(n)) {
|
||||
if Debug['m'] > 2 {
|
||||
Warnl(n.Lineno, "%v is too large for stack", n)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue