diff options
| author | Michael Pratt <mpratt@google.com> | 2024-05-03 13:03:04 -0400 |
|---|---|---|
| committer | Michael Pratt <mpratt@google.com> | 2024-10-14 19:58:47 +0000 |
| commit | c39bc22c141bc6990e4e2abf604dcf56669ff779 (patch) | |
| tree | 5384243aaaa9d9f9796674223cf186ee3ceb63a9 /test | |
| parent | 48849e0866f64a40d04a9151e44e5a73acdfc17b (diff) | |
| download | go-c39bc22c141bc6990e4e2abf604dcf56669ff779.tar.xz | |
all: wire up swisstable maps
Use the new SwissTable-based map in internal/runtime/maps as the basis
for the runtime map when GOEXPERIMENT=swissmap.
Integration is complete enough to pass all.bash. Notable missing
features:
* Race integration / concurrent write detection
* Stack-allocated maps
* Specialized "fast" map variants
* Indirect key / elem
For #54766.
Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-amd64-longtest-swissmap
Change-Id: Ie97b656b6d8e05c0403311ae08fef9f51756a639
Reviewed-on: https://go-review.googlesource.com/c/go/+/594596
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'test')
| -rw-r--r-- | test/fixedbugs/issue69110.go | 2 | ||||
| -rw-r--r-- | test/live.go | 4 | ||||
| -rw-r--r-- | test/live2.go | 4 | ||||
| -rw-r--r-- | test/live_regabi.go | 12 | ||||
| -rw-r--r-- | test/live_regabi_noswiss.go | 19 | ||||
| -rw-r--r-- | test/live_regabi_swiss.go | 19 |
6 files changed, 45 insertions, 15 deletions
diff --git a/test/fixedbugs/issue69110.go b/test/fixedbugs/issue69110.go index 71a4bcac31..ab51d0b5a6 100644 --- a/test/fixedbugs/issue69110.go +++ b/test/fixedbugs/issue69110.go @@ -1,5 +1,7 @@ // run +//go:build !goexperiment.swissmap + // Copyright 2024 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/test/live.go b/test/live.go index 8e4fdc7f46..bb67af0cd0 100644 --- a/test/live.go +++ b/test/live.go @@ -438,7 +438,7 @@ func f28(b bool) { func f29(b bool) { if b { - for k := range m { // ERROR "live at call to mapiterinit: .autotmp_[0-9]+$" "live at call to mapiternext: .autotmp_[0-9]+$" "stack object .autotmp_[0-9]+ runtime.hiter$" + for k := range m { // ERROR "live at call to mapiterinit: .autotmp_[0-9]+$" "live at call to mapiternext: .autotmp_[0-9]+$" "stack object .autotmp_[0-9]+ (runtime.hiter|internal/runtime/maps.Iter)$" printstring(k) // ERROR "live at call to printstring: .autotmp_[0-9]+$" } } @@ -647,7 +647,7 @@ func bad40() { 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$" + 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.table)$" t := &ret printnl() // ERROR "live at call to printnl: ret$" // Note: ret is live at the printnl because the compiler moves &ret diff --git a/test/live2.go b/test/live2.go index 2beac4f8d2..7b66b6c5a8 100644 --- a/test/live2.go +++ b/test/live2.go @@ -27,14 +27,14 @@ func newT40() *T40 { } func bad40() { - t := newT40() // ERROR "stack object ret T40$" "stack object .autotmp_[0-9]+ runtime.hmap$" + t := newT40() // ERROR "stack object ret T40$" "stack object .autotmp_[0-9]+ (runtime.hmap|internal/runtime/maps.table)$" printnl() // ERROR "live at call to printnl: ret$" useT40(t) } func good40() { ret := T40{} // ERROR "stack object ret T40$" - ret.m = make(map[int]int, 42) // ERROR "stack object .autotmp_[0-9]+ runtime.hmap$" + ret.m = make(map[int]int, 42) // ERROR "stack object .autotmp_[0-9]+ (runtime.hmap|internal/runtime/maps.table)$" t := &ret printnl() // ERROR "live at call to printnl: ret$" useT40(t) diff --git a/test/live_regabi.go b/test/live_regabi.go index 3bd7158ffe..28b4077493 100644 --- a/test/live_regabi.go +++ b/test/live_regabi.go @@ -434,7 +434,7 @@ func f28(b bool) { func f29(b bool) { if b { - for k := range m { // ERROR "live at call to mapiterinit: .autotmp_[0-9]+$" "live at call to mapiternext: .autotmp_[0-9]+$" "stack object .autotmp_[0-9]+ runtime.hiter$" + for k := range m { // ERROR "live at call to mapiterinit: .autotmp_[0-9]+$" "live at call to mapiternext: .autotmp_[0-9]+$" "stack object .autotmp_[0-9]+ (runtime.hiter|internal/runtime/maps.Iter)$" printstring(k) // ERROR "live at call to printstring: .autotmp_[0-9]+$" } } @@ -641,16 +641,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$" - 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_regabi_noswiss.go b/test/live_regabi_noswiss.go index 636d4e5a0c..43881c3b61 100644 --- a/test/live_regabi_noswiss.go +++ b/test/live_regabi_noswiss.go @@ -36,3 +36,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_regabi_swiss.go b/test/live_regabi_swiss.go index d35b8aadfe..e00a71409f 100644 --- a/test/live_regabi_swiss.go +++ b/test/live_regabi_swiss.go @@ -38,3 +38,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.table$" + 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) +} |
