aboutsummaryrefslogtreecommitdiff
path: root/test/escape_array.go
diff options
context:
space:
mode:
authorMateusz Poliwczak <mpoliwczak34@gmail.com>2025-02-17 11:29:04 +0000
committerGopher Robot <gobot@golang.org>2025-02-19 13:38:58 -0800
commitba3f568988bff69b3d00cd6ca76ab536eacbea48 (patch)
tree123afe80487361f0212a26035700b8b139ace8ce /test/escape_array.go
parent28d7eec3a23c04fb74863d032d499b76c3c3d4c3 (diff)
downloadgo-ba3f568988bff69b3d00cd6ca76ab536eacbea48.tar.xz
cmd/compile: determine static values of len and cap in make() calls
This change improves escape analysis by attempting to deduce static values for the len and cap parameters, allowing allocations to be made on the stack. Change-Id: I1161019aed9f60cf2c2fe4d405da94ad415231ac GitHub-Last-Rev: d78c1b4ca55fa53282e665009f689d0b013f1434 GitHub-Pull-Request: golang/go#71693 Reviewed-on: https://go-review.googlesource.com/c/go/+/649035 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'test/escape_array.go')
-rw-r--r--test/escape_array.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/escape_array.go b/test/escape_array.go
index 83062c9436..1a1eb5e4aa 100644
--- a/test/escape_array.go
+++ b/test/escape_array.go
@@ -123,7 +123,7 @@ func doesMakeSlice(x *string, y *string) { // ERROR "leaking param: x" "leaking
func nonconstArray() {
n := 32
- s1 := make([]int, n) // ERROR "make\(\[\]int, n\) escapes to heap"
- s2 := make([]int, 0, n) // ERROR "make\(\[\]int, 0, n\) escapes to heap"
+ s1 := make([]int, n) // ERROR "make\(\[\]int, 32\) does not escape"
+ s2 := make([]int, 0, n) // ERROR "make\(\[\]int, 0, 32\) does not escape"
_, _ = s1, s2
}