aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
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 /test/codegen
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 'test/codegen')
-rw-r--r--test/codegen/maps.go91
1 files changed, 69 insertions, 22 deletions
diff --git a/test/codegen/maps.go b/test/codegen/maps.go
index ea3a70d1f0..25505799e9 100644
--- a/test/codegen/maps.go
+++ b/test/codegen/maps.go
@@ -124,31 +124,78 @@ func MapClearSideEffect(m map[int]int) int {
}
func MapLiteralSizing(x int) (map[int]int, map[int]int) {
- // amd64:"MOVL\t[$]10,"
+ // This is tested for internal/abi/maps.go:MapBucketCountBits={3,4,5}
+ // amd64:"MOVL\t[$]33,"
m := map[int]int{
- 0: 0,
- 1: 1,
- 2: 2,
- 3: 3,
- 4: 4,
- 5: 5,
- 6: 6,
- 7: 7,
- 8: 8,
- 9: 9,
+ 0: 0,
+ 1: 1,
+ 2: 2,
+ 3: 3,
+ 4: 4,
+ 5: 5,
+ 6: 6,
+ 7: 7,
+ 8: 8,
+ 9: 9,
+ 10: 10,
+ 11: 11,
+ 12: 12,
+ 13: 13,
+ 14: 14,
+ 15: 15,
+ 16: 16,
+ 17: 17,
+ 18: 18,
+ 19: 19,
+ 20: 20,
+ 21: 21,
+ 22: 22,
+ 23: 23,
+ 24: 24,
+ 25: 25,
+ 26: 26,
+ 27: 27,
+ 28: 28,
+ 29: 29,
+ 30: 30,
+ 31: 32,
+ 32: 32,
}
- // amd64:"MOVL\t[$]10,"
+ // amd64:"MOVL\t[$]33,"
n := map[int]int{
- 0: x,
- 1: x,
- 2: x,
- 3: x,
- 4: x,
- 5: x,
- 6: x,
- 7: x,
- 8: x,
- 9: x,
+ 0: 0,
+ 1: 1,
+ 2: 2,
+ 3: 3,
+ 4: 4,
+ 5: 5,
+ 6: 6,
+ 7: 7,
+ 8: 8,
+ 9: 9,
+ 10: 10,
+ 11: 11,
+ 12: 12,
+ 13: 13,
+ 14: 14,
+ 15: 15,
+ 16: 16,
+ 17: 17,
+ 18: 18,
+ 19: 19,
+ 20: 20,
+ 21: 21,
+ 22: 22,
+ 23: 23,
+ 24: 24,
+ 25: 25,
+ 26: 26,
+ 27: 27,
+ 28: 28,
+ 29: 29,
+ 30: 30,
+ 31: 32,
+ 32: 32,
}
return m, n
}