]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: turn off variable-sized make() stack allocation with -N
authorKeith Randall <khr@golang.org>
Thu, 10 Apr 2025 19:46:52 +0000 (12:46 -0700)
committerKeith Randall <khr@google.com>
Sat, 12 Apr 2025 00:18:12 +0000 (17:18 -0700)
Give people a way to turn this optimization off.

(Currently the constant-sized make() stack allocation is not disabled
with -N. Kinda inconsistent, but oh well, probably worse to change it now.)

Update #73253

Change-Id: Idb9ffde444f34e70673147fd6a962368904a7a55
Reviewed-on: https://go-review.googlesource.com/c/go/+/664655
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: t hepudds <thepudds1460@gmail.com>
src/cmd/compile/internal/walk/builtin.go

index f5e558b4711ffb91683e72cdb534d6d435773160..018782211b72979483d91bed0e8270c721ae025d 100644 (file)
@@ -568,7 +568,7 @@ func walkMakeSlice(n *ir.MakeExpr, init *ir.Nodes) ir.Node {
                        // The conv is necessary in case n.Type is named.
                        return walkExpr(typecheck.Expr(typecheck.Conv(s, n.Type())), init)
                }
-               tryStack = true
+               tryStack = base.Flag.N == 0
        }
 
        // The final result is assigned to this variable.