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>
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()
}
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)
+}
}
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)
+}