@@ -39,6 +39,16 @@ func makemap64(t *abi.SwissMapType, hint int64, m *maps.Map) *maps.Map {
39
39
// makemap_small implements Go map creation for make(map[k]v) and
40
40
// make(map[k]v, hint) when hint is known to be at most abi.SwissMapGroupSlots
41
41
// at compile time and the map needs to be allocated on the heap.
42
+ //
43
+ // makemap_small should be an internal detail,
44
+ // but widely used packages access it using linkname.
45
+ // Notable members of the hall of shame include:
46
+ // - github.com/bytedance/sonic
47
+ //
48
+ // Do not remove or change the type signature.
49
+ // See go.dev/issue/67401.
50
+ //
51
+ //go:linkname makemap_small
42
52
func makemap_small () * maps.Map {
43
53
return maps .NewEmptyMap ()
44
54
}
@@ -48,6 +58,16 @@ func makemap_small() *maps.Map {
48
58
// can be created on the stack, m and optionally m.dirPtr may be non-nil.
49
59
// If m != nil, the map can be created directly in m.
50
60
// If m.dirPtr != nil, it points to a group usable for a small map.
61
+ //
62
+ // makemap should be an internal detail,
63
+ // but widely used packages access it using linkname.
64
+ // Notable members of the hall of shame include:
65
+ // - github.com/ugorji/go/codec
66
+ //
67
+ // Do not remove or change the type signature.
68
+ // See go.dev/issue/67401.
69
+ //
70
+ //go:linkname makemap
51
71
func makemap (t * abi.SwissMapType , hint int , m * maps.Map ) * maps.Map {
52
72
if hint < 0 {
53
73
hint = 0
@@ -68,6 +88,15 @@ func makemap(t *abi.SwissMapType, hint int, m *maps.Map) *maps.Map {
68
88
//go:linkname mapaccess1
69
89
func mapaccess1 (t * abi.SwissMapType , m * maps.Map , key unsafe.Pointer ) unsafe.Pointer
70
90
91
+ // mapaccess2 should be an internal detail,
92
+ // but widely used packages access it using linkname.
93
+ // Notable members of the hall of shame include:
94
+ // - github.com/ugorji/go/codec
95
+ //
96
+ // Do not remove or change the type signature.
97
+ // See go.dev/issue/67401.
98
+ //
99
+ //go:linkname mapaccess2
71
100
func mapaccess2 (t * abi.SwissMapType , m * maps.Map , key unsafe.Pointer ) (unsafe.Pointer , bool )
72
101
73
102
func mapaccess1_fat (t * abi.SwissMapType , m * maps.Map , key , zero unsafe.Pointer ) unsafe.Pointer {
@@ -89,9 +118,29 @@ func mapaccess2_fat(t *abi.SwissMapType, m *maps.Map, key, zero unsafe.Pointer)
89
118
// mapassign is pushed from internal/runtime/maps. We could just call it, but
90
119
// we want to avoid one layer of call.
91
120
//
121
+ // mapassign should be an internal detail,
122
+ // but widely used packages access it using linkname.
123
+ // Notable members of the hall of shame include:
124
+ // - github.com/bytedance/sonic
125
+ // - github.com/RomiChan/protobuf
126
+ // - github.com/segmentio/encoding
127
+ // - github.com/ugorji/go/codec
128
+ //
129
+ // Do not remove or change the type signature.
130
+ // See go.dev/issue/67401.
131
+ //
92
132
//go:linkname mapassign
93
133
func mapassign (t * abi.SwissMapType , m * maps.Map , key unsafe.Pointer ) unsafe.Pointer
94
134
135
+ // mapdelete should be an internal detail,
136
+ // but widely used packages access it using linkname.
137
+ // Notable members of the hall of shame include:
138
+ // - github.com/ugorji/go/codec
139
+ //
140
+ // Do not remove or change the type signature.
141
+ // See go.dev/issue/67401.
142
+ //
143
+ //go:linkname mapdelete
95
144
func mapdelete (t * abi.SwissMapType , m * maps.Map , key unsafe.Pointer ) {
96
145
if raceenabled && m != nil {
97
146
callerpc := sys .GetCallerPC ()
@@ -113,6 +162,21 @@ func mapdelete(t *abi.SwissMapType, m *maps.Map, key unsafe.Pointer) {
113
162
// The Iter struct pointed to by 'it' is allocated on the stack
114
163
// by the compilers order pass or on the heap by reflect_mapiterinit.
115
164
// Both need to have zeroed hiter since the struct contains pointers.
165
+ //
166
+ // mapiterinit should be an internal detail,
167
+ // but widely used packages access it using linkname.
168
+ // Notable members of the hall of shame include:
169
+ // - github.com/bytedance/sonic
170
+ // - github.com/goccy/go-json
171
+ // - github.com/RomiChan/protobuf
172
+ // - github.com/segmentio/encoding
173
+ // - github.com/ugorji/go/codec
174
+ // - github.com/wI2L/jettison
175
+ //
176
+ // Do not remove or change the type signature.
177
+ // See go.dev/issue/67401.
178
+ //
179
+ //go:linkname mapiterinit
116
180
func mapiterinit (t * abi.SwissMapType , m * maps.Map , it * maps.Iter ) {
117
181
if raceenabled && m != nil {
118
182
callerpc := sys .GetCallerPC ()
@@ -123,6 +187,19 @@ func mapiterinit(t *abi.SwissMapType, m *maps.Map, it *maps.Iter) {
123
187
it .Next ()
124
188
}
125
189
190
+ // mapiternext should be an internal detail,
191
+ // but widely used packages access it using linkname.
192
+ // Notable members of the hall of shame include:
193
+ // - github.com/bytedance/sonic
194
+ // - github.com/RomiChan/protobuf
195
+ // - github.com/segmentio/encoding
196
+ // - github.com/ugorji/go/codec
197
+ // - gonum.org/v1/gonum
198
+ //
199
+ // Do not remove or change the type signature.
200
+ // See go.dev/issue/67401.
201
+ //
202
+ //go:linkname mapiternext
126
203
func mapiternext (it * maps.Iter ) {
127
204
if raceenabled {
128
205
callerpc := sys .GetCallerPC ()
@@ -145,6 +222,19 @@ func mapclear(t *abi.SwissMapType, m *maps.Map) {
145
222
146
223
// Reflect stubs. Called from ../reflect/asm_*.s
147
224
225
+ // reflect_makemap is for package reflect,
226
+ // but widely used packages access it using linkname.
227
+ // Notable members of the hall of shame include:
228
+ // - gitee.com/quant1x/gox
229
+ // - github.com/modern-go/reflect2
230
+ // - github.com/goccy/go-json
231
+ // - github.com/RomiChan/protobuf
232
+ // - github.com/segmentio/encoding
233
+ // - github.com/v2pro/plz
234
+ //
235
+ // Do not remove or change the type signature.
236
+ // See go.dev/issue/67401.
237
+ //
148
238
//go:linkname reflect_makemap reflect.makemap
149
239
func reflect_makemap (t * abi.SwissMapType , cap int ) * maps.Map {
150
240
// Check invariants and reflects math.
@@ -156,6 +246,16 @@ func reflect_makemap(t *abi.SwissMapType, cap int) *maps.Map {
156
246
return makemap (t , cap , nil )
157
247
}
158
248
249
+ // reflect_mapaccess is for package reflect,
250
+ // but widely used packages access it using linkname.
251
+ // Notable members of the hall of shame include:
252
+ // - gitee.com/quant1x/gox
253
+ // - github.com/modern-go/reflect2
254
+ // - github.com/v2pro/plz
255
+ //
256
+ // Do not remove or change the type signature.
257
+ // See go.dev/issue/67401.
258
+ //
159
259
//go:linkname reflect_mapaccess reflect.mapaccess
160
260
func reflect_mapaccess (t * abi.SwissMapType , m * maps.Map , key unsafe.Pointer ) unsafe.Pointer {
161
261
elem , ok := mapaccess2 (t , m , key )
@@ -176,6 +276,14 @@ func reflect_mapaccess_faststr(t *abi.SwissMapType, m *maps.Map, key string) uns
176
276
return elem
177
277
}
178
278
279
+ // reflect_mapassign is for package reflect,
280
+ // but widely used packages access it using linkname.
281
+ // Notable members of the hall of shame include:
282
+ // - gitee.com/quant1x/gox
283
+ // - github.com/v2pro/plz
284
+ //
285
+ // Do not remove or change the type signature.
286
+ //
179
287
//go:linkname reflect_mapassign reflect.mapassign0
180
288
func reflect_mapassign (t * abi.SwissMapType , m * maps.Map , key unsafe.Pointer , elem unsafe.Pointer ) {
181
289
p := mapassign (t , m , key )
@@ -198,26 +306,76 @@ func reflect_mapdelete_faststr(t *abi.SwissMapType, m *maps.Map, key string) {
198
306
mapdelete_faststr (t , m , key )
199
307
}
200
308
309
+ // reflect_mapiterinit is for package reflect,
310
+ // but widely used packages access it using linkname.
311
+ // Notable members of the hall of shame include:
312
+ // - github.com/modern-go/reflect2
313
+ // - gitee.com/quant1x/gox
314
+ // - github.com/v2pro/plz
315
+ // - github.com/wI2L/jettison
316
+ //
317
+ // Do not remove or change the type signature.
318
+ // See go.dev/issue/67401.
319
+ //
201
320
//go:linkname reflect_mapiterinit reflect.mapiterinit
202
321
func reflect_mapiterinit (t * abi.SwissMapType , m * maps.Map , it * maps.Iter ) {
203
322
mapiterinit (t , m , it )
204
323
}
205
324
325
+ // reflect_mapiternext is for package reflect,
326
+ // but widely used packages access it using linkname.
327
+ // Notable members of the hall of shame include:
328
+ // - gitee.com/quant1x/gox
329
+ // - github.com/modern-go/reflect2
330
+ // - github.com/goccy/go-json
331
+ // - github.com/v2pro/plz
332
+ // - github.com/wI2L/jettison
333
+ //
334
+ // Do not remove or change the type signature.
335
+ // See go.dev/issue/67401.
336
+ //
206
337
//go:linkname reflect_mapiternext reflect.mapiternext
207
338
func reflect_mapiternext (it * maps.Iter ) {
208
339
mapiternext (it )
209
340
}
210
341
342
+ // reflect_mapiterkey was for package reflect,
343
+ // but widely used packages access it using linkname.
344
+ // Notable members of the hall of shame include:
345
+ // - github.com/goccy/go-json
346
+ // - gonum.org/v1/gonum
347
+ //
348
+ // Do not remove or change the type signature.
349
+ // See go.dev/issue/67401.
350
+ //
211
351
//go:linkname reflect_mapiterkey reflect.mapiterkey
212
352
func reflect_mapiterkey (it * maps.Iter ) unsafe.Pointer {
213
353
return it .Key ()
214
354
}
215
355
356
+ // reflect_mapiterelem was for package reflect,
357
+ // but widely used packages access it using linkname.
358
+ // Notable members of the hall of shame include:
359
+ // - github.com/goccy/go-json
360
+ // - gonum.org/v1/gonum
361
+ //
362
+ // Do not remove or change the type signature.
363
+ // See go.dev/issue/67401.
364
+ //
216
365
//go:linkname reflect_mapiterelem reflect.mapiterelem
217
366
func reflect_mapiterelem (it * maps.Iter ) unsafe.Pointer {
218
367
return it .Elem ()
219
368
}
220
369
370
+ // reflect_maplen is for package reflect,
371
+ // but widely used packages access it using linkname.
372
+ // Notable members of the hall of shame include:
373
+ // - github.com/goccy/go-json
374
+ // - github.com/wI2L/jettison
375
+ //
376
+ // Do not remove or change the type signature.
377
+ // See go.dev/issue/67401.
378
+ //
221
379
//go:linkname reflect_maplen reflect.maplen
222
380
func reflect_maplen (m * maps.Map ) int {
223
381
if m == nil {
0 commit comments