aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime-gdb_test.go
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2023-01-13 16:12:47 -0500
committerDavid Chase <drchase@google.com>2023-01-23 15:51:32 +0000
commite22bd2348c8e3bfdf12197d0b0e194b66bbf5a36 (patch)
tree0c61869dae136d804b1e82091fc562cde4bf7efe /src/runtime/runtime-gdb_test.go
parente2fe35363d070bf37326d04ed28964e6ba3892da (diff)
downloadgo-e22bd2348c8e3bfdf12197d0b0e194b66bbf5a36.tar.xz
internal/abi,runtime: refactor map constants into one place
Previously TryBot-tested with bucket bits = 4. Also tested locally with bucket bits = 5. This makes it much easier to change the size of map buckets, and hopefully provides pointers to all the code that in some way depends on details of map layout. Change-Id: I9f6669d1eadd02f182d0bc3f959dc5f385fa1683 Reviewed-on: https://go-review.googlesource.com/c/go/+/462115 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: David Chase <drchase@google.com> Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/runtime-gdb_test.go')
-rw-r--r--src/runtime/runtime-gdb_test.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/runtime/runtime-gdb_test.go b/src/runtime/runtime-gdb_test.go
index 4e7c22762a..a45654d085 100644
--- a/src/runtime/runtime-gdb_test.go
+++ b/src/runtime/runtime-gdb_test.go
@@ -8,6 +8,7 @@ import (
"bytes"
"flag"
"fmt"
+ "internal/abi"
"internal/testenv"
"os"
"os/exec"
@@ -114,13 +115,16 @@ func checkCleanBacktrace(t *testing.T, backtrace string) {
// TODO(mundaym): check for unknown frames (e.g. "??").
}
-const helloSource = `
+// NOTE: the maps below are allocated larger than abi.MapBucketCount
+// to ensure that they are not "optimized out".
+
+var helloSource = `
import "fmt"
import "runtime"
var gslice []string
func main() {
- mapvar := make(map[string]string, 13)
- slicemap := make(map[string][]string,11)
+ mapvar := make(map[string]string, ` + strconv.FormatInt(abi.MapBucketCount+9, 10) + `)
+ slicemap := make(map[string][]string,` + strconv.FormatInt(abi.MapBucketCount+3, 10) + `)
chanint := make(chan int, 10)
chanstr := make(chan string, 10)
chanint <- 99