aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2025-07-29 13:58:35 -0400
committerGopher Robot <gobot@golang.org>2025-07-30 11:47:17 -0700
commit82a1921c3b6b493c4ff358f063c2ffffabba9fd5 (patch)
tree6e5cc053bad978bc6b794e90625a2056fd38940b /src/runtime
parent2ae059ccaf982c3304fae0b48c1d78ad7192cbdd (diff)
downloadgo-82a1921c3b6b493c4ff358f063c2ffffabba9fd5.tar.xz
all: remove redundant Swiss prefixes
Now that there is only one map implementation we can simplify names. For #54766. Change-Id: I6a6a636cc6a8fc5e7712c27782fc0ced7467b939 Reviewed-on: https://go-review.googlesource.com/c/go/+/691596 Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/linkname_shim.go6
-rw-r--r--src/runtime/map.go40
-rw-r--r--src/runtime/map_fast32.go10
-rw-r--r--src/runtime/map_fast64.go10
-rw-r--r--src/runtime/map_faststr.go8
-rw-r--r--src/runtime/map_test.go2
-rw-r--r--src/runtime/runtime-gdb.py8
-rw-r--r--src/runtime/type.go4
8 files changed, 44 insertions, 44 deletions
diff --git a/src/runtime/linkname_shim.go b/src/runtime/linkname_shim.go
index 0ceff2b16c..4ba3d1fb78 100644
--- a/src/runtime/linkname_shim.go
+++ b/src/runtime/linkname_shim.go
@@ -61,7 +61,7 @@ type linknameIter struct {
// Fields from hiter.
key unsafe.Pointer
elem unsafe.Pointer
- typ *abi.SwissMapType
+ typ *abi.MapType
// The real iterator.
it *maps.Iter
@@ -85,7 +85,7 @@ type linknameIter struct {
// See go.dev/issue/67401.
//
//go:linkname mapiterinit
-func mapiterinit(t *abi.SwissMapType, m *maps.Map, it *linknameIter) {
+func mapiterinit(t *abi.MapType, m *maps.Map, it *linknameIter) {
if raceenabled && m != nil {
callerpc := sys.GetCallerPC()
racereadpc(unsafe.Pointer(m), callerpc, abi.FuncPCABIInternal(mapiterinit))
@@ -117,7 +117,7 @@ func mapiterinit(t *abi.SwissMapType, m *maps.Map, it *linknameIter) {
// See go.dev/issue/67401.
//
//go:linkname reflect_mapiterinit reflect.mapiterinit
-func reflect_mapiterinit(t *abi.SwissMapType, m *maps.Map, it *linknameIter) {
+func reflect_mapiterinit(t *abi.MapType, m *maps.Map, it *linknameIter) {
mapiterinit(t, m, it)
}
diff --git a/src/runtime/map.go b/src/runtime/map.go
index facf86e494..4a0713cfc4 100644
--- a/src/runtime/map.go
+++ b/src/runtime/map.go
@@ -20,7 +20,7 @@ const (
//go:linkname maps_errNilAssign internal/runtime/maps.errNilAssign
var maps_errNilAssign error = plainError("assignment to entry in nil map")
-func makemap64(t *abi.SwissMapType, hint int64, m *maps.Map) *maps.Map {
+func makemap64(t *abi.MapType, hint int64, m *maps.Map) *maps.Map {
if int64(int(hint)) != hint {
hint = 0
}
@@ -28,7 +28,7 @@ func makemap64(t *abi.SwissMapType, hint int64, m *maps.Map) *maps.Map {
}
// makemap_small implements Go map creation for make(map[k]v) and
-// make(map[k]v, hint) when hint is known to be at most abi.SwissMapGroupSlots
+// make(map[k]v, hint) when hint is known to be at most abi.MapGroupSlots
// at compile time and the map needs to be allocated on the heap.
//
// makemap_small should be an internal detail,
@@ -59,7 +59,7 @@ func makemap_small() *maps.Map {
// See go.dev/issue/67401.
//
//go:linkname makemap
-func makemap(t *abi.SwissMapType, hint int, m *maps.Map) *maps.Map {
+func makemap(t *abi.MapType, hint int, m *maps.Map) *maps.Map {
if hint < 0 {
hint = 0
}
@@ -77,7 +77,7 @@ func makemap(t *abi.SwissMapType, hint int, m *maps.Map) *maps.Map {
// we want to avoid one layer of call.
//
//go:linkname mapaccess1
-func mapaccess1(t *abi.SwissMapType, m *maps.Map, key unsafe.Pointer) unsafe.Pointer
+func mapaccess1(t *abi.MapType, m *maps.Map, key unsafe.Pointer) unsafe.Pointer
// mapaccess2 should be an internal detail,
// but widely used packages access it using linkname.
@@ -88,9 +88,9 @@ func mapaccess1(t *abi.SwissMapType, m *maps.Map, key unsafe.Pointer) unsafe.Poi
// See go.dev/issue/67401.
//
//go:linkname mapaccess2
-func mapaccess2(t *abi.SwissMapType, m *maps.Map, key unsafe.Pointer) (unsafe.Pointer, bool)
+func mapaccess2(t *abi.MapType, m *maps.Map, key unsafe.Pointer) (unsafe.Pointer, bool)
-func mapaccess1_fat(t *abi.SwissMapType, m *maps.Map, key, zero unsafe.Pointer) unsafe.Pointer {
+func mapaccess1_fat(t *abi.MapType, m *maps.Map, key, zero unsafe.Pointer) unsafe.Pointer {
e := mapaccess1(t, m, key)
if e == unsafe.Pointer(&zeroVal[0]) {
return zero
@@ -98,7 +98,7 @@ func mapaccess1_fat(t *abi.SwissMapType, m *maps.Map, key, zero unsafe.Pointer)
return e
}
-func mapaccess2_fat(t *abi.SwissMapType, m *maps.Map, key, zero unsafe.Pointer) (unsafe.Pointer, bool) {
+func mapaccess2_fat(t *abi.MapType, m *maps.Map, key, zero unsafe.Pointer) (unsafe.Pointer, bool) {
e := mapaccess1(t, m, key)
if e == unsafe.Pointer(&zeroVal[0]) {
return zero, false
@@ -121,7 +121,7 @@ func mapaccess2_fat(t *abi.SwissMapType, m *maps.Map, key, zero unsafe.Pointer)
// See go.dev/issue/67401.
//
//go:linkname mapassign
-func mapassign(t *abi.SwissMapType, m *maps.Map, key unsafe.Pointer) unsafe.Pointer
+func mapassign(t *abi.MapType, m *maps.Map, key unsafe.Pointer) unsafe.Pointer
// mapdelete should be an internal detail,
// but widely used packages access it using linkname.
@@ -132,7 +132,7 @@ func mapassign(t *abi.SwissMapType, m *maps.Map, key unsafe.Pointer) unsafe.Poin
// See go.dev/issue/67401.
//
//go:linkname mapdelete
-func mapdelete(t *abi.SwissMapType, m *maps.Map, key unsafe.Pointer) {
+func mapdelete(t *abi.MapType, m *maps.Map, key unsafe.Pointer) {
if raceenabled && m != nil {
callerpc := sys.GetCallerPC()
pc := abi.FuncPCABIInternal(mapdelete)
@@ -153,7 +153,7 @@ func mapdelete(t *abi.SwissMapType, m *maps.Map, key unsafe.Pointer) {
// performs the first step of iteration. The Iter struct pointed to by 'it' is
// allocated on the stack by the compilers order pass or on the heap by
// reflect. Both need to have zeroed it since the struct contains pointers.
-func mapIterStart(t *abi.SwissMapType, m *maps.Map, it *maps.Iter) {
+func mapIterStart(t *abi.MapType, m *maps.Map, it *maps.Iter) {
if raceenabled && m != nil {
callerpc := sys.GetCallerPC()
racereadpc(unsafe.Pointer(m), callerpc, abi.FuncPCABIInternal(mapIterStart))
@@ -175,7 +175,7 @@ func mapIterNext(it *maps.Iter) {
}
// mapclear deletes all keys from a map.
-func mapclear(t *abi.SwissMapType, m *maps.Map) {
+func mapclear(t *abi.MapType, m *maps.Map) {
if raceenabled && m != nil {
callerpc := sys.GetCallerPC()
pc := abi.FuncPCABIInternal(mapclear)
@@ -201,7 +201,7 @@ func mapclear(t *abi.SwissMapType, m *maps.Map) {
// See go.dev/issue/67401.
//
//go:linkname reflect_makemap reflect.makemap
-func reflect_makemap(t *abi.SwissMapType, cap int) *maps.Map {
+func reflect_makemap(t *abi.MapType, cap int) *maps.Map {
// Check invariants and reflects math.
if t.Key.Equal == nil {
throw("runtime.reflect_makemap: unsupported map key type")
@@ -222,7 +222,7 @@ func reflect_makemap(t *abi.SwissMapType, cap int) *maps.Map {
// See go.dev/issue/67401.
//
//go:linkname reflect_mapaccess reflect.mapaccess
-func reflect_mapaccess(t *abi.SwissMapType, m *maps.Map, key unsafe.Pointer) unsafe.Pointer {
+func reflect_mapaccess(t *abi.MapType, m *maps.Map, key unsafe.Pointer) unsafe.Pointer {
elem, ok := mapaccess2(t, m, key)
if !ok {
// reflect wants nil for a missing element
@@ -232,7 +232,7 @@ func reflect_mapaccess(t *abi.SwissMapType, m *maps.Map, key unsafe.Pointer) uns
}
//go:linkname reflect_mapaccess_faststr reflect.mapaccess_faststr
-func reflect_mapaccess_faststr(t *abi.SwissMapType, m *maps.Map, key string) unsafe.Pointer {
+func reflect_mapaccess_faststr(t *abi.MapType, m *maps.Map, key string) unsafe.Pointer {
elem, ok := mapaccess2_faststr(t, m, key)
if !ok {
// reflect wants nil for a missing element
@@ -250,24 +250,24 @@ func reflect_mapaccess_faststr(t *abi.SwissMapType, m *maps.Map, key string) uns
// Do not remove or change the type signature.
//
//go:linkname reflect_mapassign reflect.mapassign0
-func reflect_mapassign(t *abi.SwissMapType, m *maps.Map, key unsafe.Pointer, elem unsafe.Pointer) {
+func reflect_mapassign(t *abi.MapType, m *maps.Map, key unsafe.Pointer, elem unsafe.Pointer) {
p := mapassign(t, m, key)
typedmemmove(t.Elem, p, elem)
}
//go:linkname reflect_mapassign_faststr reflect.mapassign_faststr0
-func reflect_mapassign_faststr(t *abi.SwissMapType, m *maps.Map, key string, elem unsafe.Pointer) {
+func reflect_mapassign_faststr(t *abi.MapType, m *maps.Map, key string, elem unsafe.Pointer) {
p := mapassign_faststr(t, m, key)
typedmemmove(t.Elem, p, elem)
}
//go:linkname reflect_mapdelete reflect.mapdelete
-func reflect_mapdelete(t *abi.SwissMapType, m *maps.Map, key unsafe.Pointer) {
+func reflect_mapdelete(t *abi.MapType, m *maps.Map, key unsafe.Pointer) {
mapdelete(t, m, key)
}
//go:linkname reflect_mapdelete_faststr reflect.mapdelete_faststr
-func reflect_mapdelete_faststr(t *abi.SwissMapType, m *maps.Map, key string) {
+func reflect_mapdelete_faststr(t *abi.MapType, m *maps.Map, key string) {
mapdelete_faststr(t, m, key)
}
@@ -293,7 +293,7 @@ func reflect_maplen(m *maps.Map) int {
}
//go:linkname reflect_mapclear reflect.mapclear
-func reflect_mapclear(t *abi.SwissMapType, m *maps.Map) {
+func reflect_mapclear(t *abi.MapType, m *maps.Map) {
mapclear(t, m)
}
@@ -321,7 +321,7 @@ func mapinitnoop()
//go:linkname mapclone maps.clone
func mapclone(m any) any {
e := efaceOf(&m)
- typ := (*abi.SwissMapType)(unsafe.Pointer(e._type))
+ typ := (*abi.MapType)(unsafe.Pointer(e._type))
map_ := (*maps.Map)(e.data)
map_ = map_.Clone(typ)
e.data = (unsafe.Pointer)(map_)
diff --git a/src/runtime/map_fast32.go b/src/runtime/map_fast32.go
index 8b460edf77..17b4c31d02 100644
--- a/src/runtime/map_fast32.go
+++ b/src/runtime/map_fast32.go
@@ -13,7 +13,7 @@ import (
// Functions below pushed from internal/runtime/maps.
//go:linkname mapaccess1_fast32
-func mapaccess1_fast32(t *abi.SwissMapType, m *maps.Map, key uint32) unsafe.Pointer
+func mapaccess1_fast32(t *abi.MapType, m *maps.Map, key uint32) unsafe.Pointer
// mapaccess2_fast32 should be an internal detail,
// but widely used packages access it using linkname.
@@ -24,7 +24,7 @@ func mapaccess1_fast32(t *abi.SwissMapType, m *maps.Map, key uint32) unsafe.Poin
// See go.dev/issue/67401.
//
//go:linkname mapaccess2_fast32
-func mapaccess2_fast32(t *abi.SwissMapType, m *maps.Map, key uint32) (unsafe.Pointer, bool)
+func mapaccess2_fast32(t *abi.MapType, m *maps.Map, key uint32) (unsafe.Pointer, bool)
// mapassign_fast32 should be an internal detail,
// but widely used packages access it using linkname.
@@ -36,7 +36,7 @@ func mapaccess2_fast32(t *abi.SwissMapType, m *maps.Map, key uint32) (unsafe.Poi
// See go.dev/issue/67401.
//
//go:linkname mapassign_fast32
-func mapassign_fast32(t *abi.SwissMapType, m *maps.Map, key uint32) unsafe.Pointer
+func mapassign_fast32(t *abi.MapType, m *maps.Map, key uint32) unsafe.Pointer
// mapassign_fast32ptr should be an internal detail,
// but widely used packages access it using linkname.
@@ -47,7 +47,7 @@ func mapassign_fast32(t *abi.SwissMapType, m *maps.Map, key uint32) unsafe.Point
// See go.dev/issue/67401.
//
//go:linkname mapassign_fast32ptr
-func mapassign_fast32ptr(t *abi.SwissMapType, m *maps.Map, key unsafe.Pointer) unsafe.Pointer
+func mapassign_fast32ptr(t *abi.MapType, m *maps.Map, key unsafe.Pointer) unsafe.Pointer
//go:linkname mapdelete_fast32
-func mapdelete_fast32(t *abi.SwissMapType, m *maps.Map, key uint32)
+func mapdelete_fast32(t *abi.MapType, m *maps.Map, key uint32)
diff --git a/src/runtime/map_fast64.go b/src/runtime/map_fast64.go
index 5de22a5bea..8640acf6a6 100644
--- a/src/runtime/map_fast64.go
+++ b/src/runtime/map_fast64.go
@@ -13,7 +13,7 @@ import (
// Functions below pushed from internal/runtime/maps.
//go:linkname mapaccess1_fast64
-func mapaccess1_fast64(t *abi.SwissMapType, m *maps.Map, key uint64) unsafe.Pointer
+func mapaccess1_fast64(t *abi.MapType, m *maps.Map, key uint64) unsafe.Pointer
// mapaccess2_fast64 should be an internal detail,
// but widely used packages access it using linkname.
@@ -24,7 +24,7 @@ func mapaccess1_fast64(t *abi.SwissMapType, m *maps.Map, key uint64) unsafe.Poin
// See go.dev/issue/67401.
//
//go:linkname mapaccess2_fast64
-func mapaccess2_fast64(t *abi.SwissMapType, m *maps.Map, key uint64) (unsafe.Pointer, bool)
+func mapaccess2_fast64(t *abi.MapType, m *maps.Map, key uint64) (unsafe.Pointer, bool)
// mapassign_fast64 should be an internal detail,
// but widely used packages access it using linkname.
@@ -36,7 +36,7 @@ func mapaccess2_fast64(t *abi.SwissMapType, m *maps.Map, key uint64) (unsafe.Poi
// See go.dev/issue/67401.
//
//go:linkname mapassign_fast64
-func mapassign_fast64(t *abi.SwissMapType, m *maps.Map, key uint64) unsafe.Pointer
+func mapassign_fast64(t *abi.MapType, m *maps.Map, key uint64) unsafe.Pointer
// mapassign_fast64ptr should be an internal detail,
// but widely used packages access it using linkname.
@@ -48,7 +48,7 @@ func mapassign_fast64(t *abi.SwissMapType, m *maps.Map, key uint64) unsafe.Point
// See go.dev/issue/67401.
//
//go:linkname mapassign_fast64ptr
-func mapassign_fast64ptr(t *abi.SwissMapType, m *maps.Map, key unsafe.Pointer) unsafe.Pointer
+func mapassign_fast64ptr(t *abi.MapType, m *maps.Map, key unsafe.Pointer) unsafe.Pointer
//go:linkname mapdelete_fast64
-func mapdelete_fast64(t *abi.SwissMapType, m *maps.Map, key uint64)
+func mapdelete_fast64(t *abi.MapType, m *maps.Map, key uint64)
diff --git a/src/runtime/map_faststr.go b/src/runtime/map_faststr.go
index ca16a8eab6..5a7b52d037 100644
--- a/src/runtime/map_faststr.go
+++ b/src/runtime/map_faststr.go
@@ -13,7 +13,7 @@ import (
// Functions below pushed from internal/runtime/maps.
//go:linkname mapaccess1_faststr
-func mapaccess1_faststr(t *abi.SwissMapType, m *maps.Map, ky string) unsafe.Pointer
+func mapaccess1_faststr(t *abi.MapType, m *maps.Map, ky string) unsafe.Pointer
// mapaccess2_faststr should be an internal detail,
// but widely used packages access it using linkname.
@@ -24,7 +24,7 @@ func mapaccess1_faststr(t *abi.SwissMapType, m *maps.Map, ky string) unsafe.Poin
// See go.dev/issue/67401.
//
//go:linkname mapaccess2_faststr
-func mapaccess2_faststr(t *abi.SwissMapType, m *maps.Map, ky string) (unsafe.Pointer, bool)
+func mapaccess2_faststr(t *abi.MapType, m *maps.Map, ky string) (unsafe.Pointer, bool)
// mapassign_faststr should be an internal detail,
// but widely used packages access it using linkname.
@@ -36,7 +36,7 @@ func mapaccess2_faststr(t *abi.SwissMapType, m *maps.Map, ky string) (unsafe.Poi
// See go.dev/issue/67401.
//
//go:linkname mapassign_faststr
-func mapassign_faststr(t *abi.SwissMapType, m *maps.Map, s string) unsafe.Pointer
+func mapassign_faststr(t *abi.MapType, m *maps.Map, s string) unsafe.Pointer
//go:linkname mapdelete_faststr
-func mapdelete_faststr(t *abi.SwissMapType, m *maps.Map, ky string)
+func mapdelete_faststr(t *abi.MapType, m *maps.Map, ky string)
diff --git a/src/runtime/map_test.go b/src/runtime/map_test.go
index ff7fbeb230..7fe8399130 100644
--- a/src/runtime/map_test.go
+++ b/src/runtime/map_test.go
@@ -1157,7 +1157,7 @@ func TestHmapSize(t *testing.T) {
func TestGroupSizeZero(t *testing.T) {
var m map[struct{}]struct{}
mTyp := abi.TypeOf(m)
- mt := (*abi.SwissMapType)(unsafe.Pointer(mTyp))
+ mt := (*abi.MapType)(unsafe.Pointer(mTyp))
// internal/runtime/maps when create pointers to slots, even if slots
// are size 0. The compiler should have reserved an extra word to
diff --git a/src/runtime/runtime-gdb.py b/src/runtime/runtime-gdb.py
index 23b1f331c8..345a59605e 100644
--- a/src/runtime/runtime-gdb.py
+++ b/src/runtime/runtime-gdb.py
@@ -160,7 +160,7 @@ class MapTypePrinter:
return str(self.val.type)
def children(self):
- SwissMapGroupSlots = 8 # see internal/abi:SwissMapGroupSlots
+ MapGroupSlots = 8 # see internal/abi:MapGroupSlots
cnt = 0
# Yield keys and elements in group.
@@ -168,7 +168,7 @@ class MapTypePrinter:
def group_slots(group):
ctrl = group['ctrl']
- for i in xrange(SwissMapGroupSlots):
+ for i in xrange(MapGroupSlots):
c = (ctrl >> (8*i)) & 0xff
if (c & 0x80) != 0:
# Empty or deleted
@@ -179,7 +179,7 @@ class MapTypePrinter:
yield str(cnt+1), group['slots'][i]['elem']
# The linker DWARF generation
- # (cmd/link/internal/ld.(*dwctxt).synthesizemaptypesSwiss) records
+ # (cmd/link/internal/ld.(*dwctxt).synthesizemaptypes) records
# dirPtr as a **table[K,V], but it may actually be two different types:
#
# For "full size" maps (dirLen > 0), dirPtr is actually a pointer to
@@ -242,7 +242,7 @@ class MapTypePrinter:
length = table['groups']['lengthMask'] + 1
# The linker DWARF generation
- # (cmd/link/internal/ld.(*dwctxt).synthesizemaptypesSwiss) records
+ # (cmd/link/internal/ld.(*dwctxt).synthesizemaptypes) records
# groups.data as a *group[K,V], but it is actually a pointer to
# variable length array *[length]group[K,V].
#
diff --git a/src/runtime/type.go b/src/runtime/type.go
index 636ea3a485..9009119464 100644
--- a/src/runtime/type.go
+++ b/src/runtime/type.go
@@ -604,8 +604,8 @@ func typesEqual(t, v *_type, seen map[_typePair]struct{}) bool {
}
return true
case abi.Map:
- mt := (*abi.SwissMapType)(unsafe.Pointer(t))
- mv := (*abi.SwissMapType)(unsafe.Pointer(v))
+ mt := (*abi.MapType)(unsafe.Pointer(t))
+ mv := (*abi.MapType)(unsafe.Pointer(v))
return typesEqual(mt.Key, mv.Key, seen) && typesEqual(mt.Elem, mv.Elem, seen)
case abi.Pointer:
pt := (*ptrtype)(unsafe.Pointer(t))