]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: move zeroVal out of map.go
authorMichael Pratt <mpratt@google.com>
Fri, 19 Apr 2024 17:46:16 +0000 (13:46 -0400)
committerGopher Robot <gobot@golang.org>
Mon, 22 Apr 2024 20:09:01 +0000 (20:09 +0000)
It isn't specific to maps, so put it in a more general location.

For #54766.

Change-Id: Ia3f3ebe8c347cfa5a8582082a306f4df4e05818d
Reviewed-on: https://go-review.googlesource.com/c/go/+/580777
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/internal/abi/map.go
src/internal/abi/runtime.go [new file with mode: 0644]
src/runtime/map.go
src/runtime/runtime.go

index b475cf9943470cbde393244ff9a8d4ef7bf41650..12ad1b891a78a0313add12f8921aac81b8d1f03a 100644 (file)
@@ -17,6 +17,3 @@ const (
        MapMaxKeyBytes  = 128
        MapMaxElemBytes = 128 // Must fit in a uint8.
 )
-
-// ZeroValSize is the size in bytes of runtime.zeroVal.
-const ZeroValSize = 1024
diff --git a/src/internal/abi/runtime.go b/src/internal/abi/runtime.go
new file mode 100644 (file)
index 0000000..9b91cdf
--- /dev/null
@@ -0,0 +1,8 @@
+// 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.
+
+package abi
+
+// ZeroValSize is the size in bytes of runtime.zeroVal.
+const ZeroValSize = 1024
index 6a9345e0b403df0cd09c0971a28343e9d551562f..d97e209deb90008aca5e38a558e186bb63c1c099 100644 (file)
@@ -1423,8 +1423,6 @@ func reflectlite_maplen(h *hmap) int {
        return h.count
 }
 
-var zeroVal [abi.ZeroValSize]byte
-
 // mapinitnoop is a no-op function known the Go linker; if a given global
 // map (of the right size) is determined to be dead, the linker will
 // rewrite the relocation (from the package init func) from the outlined
index cc6f03d2a086dfd76b80563a0f8c3646247cd55a..6ec0369a7e59d89d7d002afa6c6c8701f37e83d9 100644 (file)
@@ -5,6 +5,7 @@
 package runtime
 
 import (
+       "internal/abi"
        "internal/runtime/atomic"
        "unsafe"
 )
@@ -296,3 +297,5 @@ func setCrashFD(fd uintptr) uintptr {
 var auxv []uintptr
 
 func getAuxv() []uintptr { return auxv } // accessed from x/sys/cpu; see issue 57336
+
+var zeroVal [abi.ZeroValSize]byte