mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
e2fe35363d
commit
e22bd2348c
13 changed files with 195 additions and 80 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue