From 8668d7bbb93285e3f8456fe6e4f666db51bdcadd Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Mon, 21 Oct 2024 12:58:22 -0400 Subject: [PATCH] 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 Auto-Submit: Michael Pratt LUCI-TryBot-Result: Go LUCI Reviewed-by: Keith Randall --- test/live.go | 10 ---------- test/live_noswiss.go | 19 +++++++++++++++++++ test/live_swiss.go | 19 +++++++++++++++++++ 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) +} -- 2.48.1