@@ -15,10 +15,10 @@ import (
15
15
"internal/abi"
16
16
)
17
17
18
- // SwissMapGroupType makes the map slot group type given the type of the map.
19
- func SwissMapGroupType (t * types.Type ) * types.Type {
20
- if t .MapType ().SwissGroup != nil {
21
- return t .MapType ().SwissGroup
18
+ // MapGroupType makes the map slot group type given the type of the map.
19
+ func MapGroupType (t * types.Type ) * types.Type {
20
+ if t .MapType ().Group != nil {
21
+ return t .MapType ().Group
22
22
}
23
23
24
24
// Builds a type representing a group structure for the given map type.
@@ -29,7 +29,7 @@ func SwissMapGroupType(t *types.Type) *types.Type {
29
29
//
30
30
// type group struct {
31
31
// ctrl uint64
32
- // slots [abi.SwissMapGroupSlots ]struct {
32
+ // slots [abi.MapGroupSlots ]struct {
33
33
// key keyType
34
34
// elem elemType
35
35
// }
@@ -39,10 +39,10 @@ func SwissMapGroupType(t *types.Type) *types.Type {
39
39
elemtype := t .Elem ()
40
40
types .CalcSize (keytype )
41
41
types .CalcSize (elemtype )
42
- if keytype .Size () > abi .SwissMapMaxKeyBytes {
42
+ if keytype .Size () > abi .MapMaxKeyBytes {
43
43
keytype = types .NewPtr (keytype )
44
44
}
45
- if elemtype .Size () > abi .SwissMapMaxElemBytes {
45
+ if elemtype .Size () > abi .MapMaxElemBytes {
46
46
elemtype = types .NewPtr (elemtype )
47
47
}
48
48
@@ -53,7 +53,7 @@ func SwissMapGroupType(t *types.Type) *types.Type {
53
53
slot := types .NewStruct (slotFields )
54
54
slot .SetNoalg (true )
55
55
56
- slotArr := types .NewArray (slot , abi .SwissMapGroupSlots )
56
+ slotArr := types .NewArray (slot , abi .MapGroupSlots )
57
57
slotArr .SetNoalg (true )
58
58
59
59
fields := []* types.Field {
@@ -76,25 +76,25 @@ func SwissMapGroupType(t *types.Type) *types.Type {
76
76
// the end to ensure pointers are valid.
77
77
base .Fatalf ("bad group size for %v" , t )
78
78
}
79
- if t .Key ().Size () > abi .SwissMapMaxKeyBytes && ! keytype .IsPtr () {
79
+ if t .Key ().Size () > abi .MapMaxKeyBytes && ! keytype .IsPtr () {
80
80
base .Fatalf ("key indirect incorrect for %v" , t )
81
81
}
82
- if t .Elem ().Size () > abi .SwissMapMaxElemBytes && ! elemtype .IsPtr () {
82
+ if t .Elem ().Size () > abi .MapMaxElemBytes && ! elemtype .IsPtr () {
83
83
base .Fatalf ("elem indirect incorrect for %v" , t )
84
84
}
85
85
86
- t .MapType ().SwissGroup = group
86
+ t .MapType ().Group = group
87
87
group .StructType ().Map = t
88
88
return group
89
89
}
90
90
91
- var cachedSwissTableType * types.Type
91
+ var cachedMapTableType * types.Type
92
92
93
- // swissTableType returns a type interchangeable with internal/runtime/maps.table.
93
+ // mapTableType returns a type interchangeable with internal/runtime/maps.table.
94
94
// Make sure this stays in sync with internal/runtime/maps/table.go.
95
- func swissTableType () * types.Type {
96
- if cachedSwissTableType != nil {
97
- return cachedSwissTableType
95
+ func mapTableType () * types.Type {
96
+ if cachedMapTableType != nil {
97
+ return cachedMapTableType
98
98
}
99
99
100
100
// type table struct {
@@ -135,17 +135,17 @@ func swissTableType() *types.Type {
135
135
base .Fatalf ("internal/runtime/maps.table size not correct: got %d, want %d" , table .Size (), size )
136
136
}
137
137
138
- cachedSwissTableType = table
138
+ cachedMapTableType = table
139
139
return table
140
140
}
141
141
142
- var cachedSwissMapType * types.Type
142
+ var cachedMapType * types.Type
143
143
144
- // SwissMapType returns a type interchangeable with internal/runtime/maps.Map.
144
+ // MapType returns a type interchangeable with internal/runtime/maps.Map.
145
145
// Make sure this stays in sync with internal/runtime/maps/map.go.
146
- func SwissMapType () * types.Type {
147
- if cachedSwissMapType != nil {
148
- return cachedSwissMapType
146
+ func MapType () * types.Type {
147
+ if cachedMapType != nil {
148
+ return cachedMapType
149
149
}
150
150
151
151
// type Map struct {
@@ -191,23 +191,23 @@ func SwissMapType() *types.Type {
191
191
base .Fatalf ("internal/runtime/maps.Map size not correct: got %d, want %d" , m .Size (), size )
192
192
}
193
193
194
- cachedSwissMapType = m
194
+ cachedMapType = m
195
195
return m
196
196
}
197
197
198
- var cachedSwissIterType * types.Type
198
+ var cachedMapIterType * types.Type
199
199
200
- // SwissMapIterType returns a type interchangeable with runtime.hiter .
201
- // Make sure this stays in sync with runtime/map .go.
202
- func SwissMapIterType () * types.Type {
203
- if cachedSwissIterType != nil {
204
- return cachedSwissIterType
200
+ // MapIterType returns a type interchangeable with internal/ runtime/maps.Iter .
201
+ // Make sure this stays in sync with internal/ runtime/maps/table .go.
202
+ func MapIterType () * types.Type {
203
+ if cachedMapIterType != nil {
204
+ return cachedMapIterType
205
205
}
206
206
207
207
// type Iter struct {
208
208
// key unsafe.Pointer // *Key
209
209
// elem unsafe.Pointer // *Elem
210
- // typ unsafe.Pointer // *SwissMapType
210
+ // typ unsafe.Pointer // *MapType
211
211
// m *Map
212
212
//
213
213
// groupSlotOffset uint64
@@ -231,13 +231,13 @@ func SwissMapIterType() *types.Type {
231
231
makefield ("key" , types .Types [types .TUNSAFEPTR ]), // Used in range.go for TMAP.
232
232
makefield ("elem" , types .Types [types .TUNSAFEPTR ]), // Used in range.go for TMAP.
233
233
makefield ("typ" , types .Types [types .TUNSAFEPTR ]),
234
- makefield ("m" , types .NewPtr (SwissMapType ())),
234
+ makefield ("m" , types .NewPtr (MapType ())),
235
235
makefield ("groupSlotOffset" , types .Types [types .TUINT64 ]),
236
236
makefield ("dirOffset" , types .Types [types .TUINT64 ]),
237
237
makefield ("clearSeq" , types .Types [types .TUINT64 ]),
238
238
makefield ("globalDepth" , types .Types [types .TUINT8 ]),
239
239
makefield ("dirIdx" , types .Types [types .TINT ]),
240
- makefield ("tab" , types .NewPtr (swissTableType ())),
240
+ makefield ("tab" , types .NewPtr (mapTableType ())),
241
241
makefield ("group" , types .Types [types .TUNSAFEPTR ]),
242
242
makefield ("entryIdx" , types .Types [types .TUINT64 ]),
243
243
}
@@ -257,13 +257,13 @@ func SwissMapIterType() *types.Type {
257
257
base .Fatalf ("internal/runtime/maps.Iter size not correct: got %d, want %d" , iter .Size (), size )
258
258
}
259
259
260
- cachedSwissIterType = iter
260
+ cachedMapIterType = iter
261
261
return iter
262
262
}
263
263
264
- func writeSwissMapType (t * types.Type , lsym * obj.LSym , c rttype.Cursor ) {
265
- // internal/abi.SwissMapType
266
- gtyp := SwissMapGroupType (t )
264
+ func writeMapType (t * types.Type , lsym * obj.LSym , c rttype.Cursor ) {
265
+ // internal/abi.MapType
266
+ gtyp := MapGroupType (t )
267
267
s1 := writeType (t .Key ())
268
268
s2 := writeType (t .Elem ())
269
269
s3 := writeType (gtyp )
@@ -287,16 +287,16 @@ func writeSwissMapType(t *types.Type, lsym *obj.LSym, c rttype.Cursor) {
287
287
c .Field ("ElemOff" ).WriteUintptr (uint64 (elemOff ))
288
288
var flags uint32
289
289
if needkeyupdate (t .Key ()) {
290
- flags |= abi .SwissMapNeedKeyUpdate
290
+ flags |= abi .MapNeedKeyUpdate
291
291
}
292
292
if hashMightPanic (t .Key ()) {
293
- flags |= abi .SwissMapHashMightPanic
293
+ flags |= abi .MapHashMightPanic
294
294
}
295
- if t .Key ().Size () > abi .SwissMapMaxKeyBytes {
296
- flags |= abi .SwissMapIndirectKey
295
+ if t .Key ().Size () > abi .MapMaxKeyBytes {
296
+ flags |= abi .MapIndirectKey
297
297
}
298
- if t .Elem ().Size () > abi .SwissMapMaxKeyBytes {
299
- flags |= abi .SwissMapIndirectElem
298
+ if t .Elem ().Size () > abi .MapMaxKeyBytes {
299
+ flags |= abi .MapIndirectElem
300
300
}
301
301
c .Field ("Flags" ).WriteUint32 (flags )
302
302
0 commit comments