aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2024-10-21 12:58:22 -0400
committerGopher Robot <gobot@golang.org>2024-10-21 20:54:57 +0000
commit8668d7bbb93285e3f8456fe6e4f666db51bdcadd (patch)
treec3f2e6b2d0bac93ed60b45a309cc77ad17fa2385 /test
parent205ab8a3fe8d7feaedea67d44f09d8ac6af59fd8 (diff)
downloadgo-8668d7bbb93285e3f8456fe6e4f666db51bdcadd.tar.xz
test: split non-regabi stack map test
CL 594596 already did this for regabi, but missed non-regabi. Stack allocated swiss maps don't call rand32. For #54766. Change-Id: I312ea77532ecc6fa860adfea58ea00b01683ca69 Reviewed-on: https://go-review.googlesource.com/c/go/+/621615 Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'test')
-rw-r--r--test/live.go10
-rw-r--r--test/live_noswiss.go19
-rw-r--r--test/live_swiss.go19
3 files changed, 38 insertions, 10 deletions
diff --git a/test/live.go b/test/live.go
index fb637526db..703e9950af 100644
--- a/test/live.go
+++ b/test/live.go
@@ -645,16 +645,6 @@ func bad40() {
printnl()
}
-func good40() {
- ret := T40{} // ERROR "stack object ret T40$"
- ret.m = make(map[int]int) // ERROR "live at call to rand32: .autotmp_[0-9]+$" "stack object .autotmp_[0-9]+ (runtime.hmap|internal/runtime/maps.Map)$"
- t := &ret
- printnl() // ERROR "live at call to printnl: ret$"
- // Note: ret is live at the printnl because the compiler moves &ret
- // from before the printnl to after.
- useT40(t)
-}
-
func ddd1(x, y *int) { // ERROR "live at entry to ddd1: x y$"
ddd2(x, y) // ERROR "stack object .autotmp_[0-9]+ \[2\]\*int$"
printnl()
diff --git a/test/live_noswiss.go b/test/live_noswiss.go
index f9c78290c4..8a96cb05fc 100644
--- a/test/live_noswiss.go
+++ b/test/live_noswiss.go
@@ -40,3 +40,22 @@ func f17c() {
}
func f17d() *byte
+
+func printnl()
+
+type T40 struct {
+ m map[int]int
+}
+
+//go:noescape
+func useT40(*T40)
+
+func good40() {
+ ret := T40{} // ERROR "stack object ret T40$"
+ ret.m = make(map[int]int) // ERROR "live at call to rand32: .autotmp_[0-9]+$" "stack object .autotmp_[0-9]+ runtime.hmap$"
+ t := &ret
+ printnl() // ERROR "live at call to printnl: ret$"
+ // Note: ret is live at the printnl because the compiler moves &ret
+ // from before the printnl to after.
+ useT40(t)
+}
diff --git a/test/live_swiss.go b/test/live_swiss.go
index 2c91435c47..fab15fc9f3 100644
--- a/test/live_swiss.go
+++ b/test/live_swiss.go
@@ -42,3 +42,22 @@ func f17c() {
}
func f17d() *byte
+
+func printnl()
+
+type T40 struct {
+ m map[int]int
+}
+
+//go:noescape
+func useT40(*T40)
+
+func good40() {
+ ret := T40{} // ERROR "stack object ret T40$"
+ ret.m = make(map[int]int) // ERROR "stack object .autotmp_[0-9]+ internal/runtime/maps.Map$"
+ t := &ret
+ printnl() // ERROR "live at call to printnl: ret$"
+ // Note: ret is live at the printnl because the compiler moves &ret
+ // from before the printnl to after.
+ useT40(t)
+}