1
2
3 package typecheck
4
5 import (
6 "cmd/compile/internal/types"
7 "cmd/internal/src"
8 )
9
10
11
12
13 func newSig(params, results []*types.Field) *types.Type {
14 return types.NewSignature(nil, params, results)
15 }
16
17 func params(tlist ...*types.Type) []*types.Field {
18 flist := make([]*types.Field, len(tlist))
19 for i, typ := range tlist {
20 flist[i] = types.NewField(src.NoXPos, nil, typ)
21 }
22 return flist
23 }
24
25 var runtimeDecls = [...]struct {
26 name string
27 tag int
28 typ int
29 }{
30 {"newobject", funcTag, 4},
31 {"mallocgc", funcTag, 8},
32 {"panicdivide", funcTag, 9},
33 {"panicshift", funcTag, 9},
34 {"panicmakeslicelen", funcTag, 9},
35 {"panicmakeslicecap", funcTag, 9},
36 {"throwinit", funcTag, 9},
37 {"panicwrap", funcTag, 9},
38 {"gopanic", funcTag, 11},
39 {"gorecover", funcTag, 14},
40 {"goschedguarded", funcTag, 9},
41 {"goPanicIndex", funcTag, 16},
42 {"goPanicIndexU", funcTag, 18},
43 {"goPanicSliceAlen", funcTag, 16},
44 {"goPanicSliceAlenU", funcTag, 18},
45 {"goPanicSliceAcap", funcTag, 16},
46 {"goPanicSliceAcapU", funcTag, 18},
47 {"goPanicSliceB", funcTag, 16},
48 {"goPanicSliceBU", funcTag, 18},
49 {"goPanicSlice3Alen", funcTag, 16},
50 {"goPanicSlice3AlenU", funcTag, 18},
51 {"goPanicSlice3Acap", funcTag, 16},
52 {"goPanicSlice3AcapU", funcTag, 18},
53 {"goPanicSlice3B", funcTag, 16},
54 {"goPanicSlice3BU", funcTag, 18},
55 {"goPanicSlice3C", funcTag, 16},
56 {"goPanicSlice3CU", funcTag, 18},
57 {"goPanicSliceConvert", funcTag, 16},
58 {"printbool", funcTag, 19},
59 {"printfloat", funcTag, 21},
60 {"printint", funcTag, 23},
61 {"printhex", funcTag, 25},
62 {"printuint", funcTag, 25},
63 {"printcomplex", funcTag, 27},
64 {"printstring", funcTag, 29},
65 {"printpointer", funcTag, 30},
66 {"printuintptr", funcTag, 31},
67 {"printiface", funcTag, 30},
68 {"printeface", funcTag, 30},
69 {"printslice", funcTag, 30},
70 {"printnl", funcTag, 9},
71 {"printsp", funcTag, 9},
72 {"printlock", funcTag, 9},
73 {"printunlock", funcTag, 9},
74 {"concatstring2", funcTag, 34},
75 {"concatstring3", funcTag, 35},
76 {"concatstring4", funcTag, 36},
77 {"concatstring5", funcTag, 37},
78 {"concatstrings", funcTag, 39},
79 {"cmpstring", funcTag, 40},
80 {"intstring", funcTag, 43},
81 {"slicebytetostring", funcTag, 44},
82 {"slicebytetostringtmp", funcTag, 45},
83 {"slicerunetostring", funcTag, 48},
84 {"stringtoslicebyte", funcTag, 50},
85 {"stringtoslicerune", funcTag, 53},
86 {"slicecopy", funcTag, 54},
87 {"decoderune", funcTag, 55},
88 {"countrunes", funcTag, 56},
89 {"convT", funcTag, 57},
90 {"convTnoptr", funcTag, 57},
91 {"convT16", funcTag, 59},
92 {"convT32", funcTag, 61},
93 {"convT64", funcTag, 62},
94 {"convTstring", funcTag, 63},
95 {"convTslice", funcTag, 66},
96 {"assertE2I", funcTag, 67},
97 {"assertE2I2", funcTag, 67},
98 {"panicdottypeE", funcTag, 68},
99 {"panicdottypeI", funcTag, 68},
100 {"panicnildottype", funcTag, 69},
101 {"typeAssert", funcTag, 67},
102 {"interfaceSwitch", funcTag, 70},
103 {"ifaceeq", funcTag, 72},
104 {"efaceeq", funcTag, 72},
105 {"panicrangeexit", funcTag, 9},
106 {"deferrangefunc", funcTag, 73},
107 {"rand32", funcTag, 74},
108 {"makemap64", funcTag, 76},
109 {"makemap", funcTag, 77},
110 {"makemap_small", funcTag, 78},
111 {"mapaccess1", funcTag, 79},
112 {"mapaccess1_fast32", funcTag, 80},
113 {"mapaccess1_fast64", funcTag, 81},
114 {"mapaccess1_faststr", funcTag, 82},
115 {"mapaccess1_fat", funcTag, 83},
116 {"mapaccess2", funcTag, 84},
117 {"mapaccess2_fast32", funcTag, 85},
118 {"mapaccess2_fast64", funcTag, 86},
119 {"mapaccess2_faststr", funcTag, 87},
120 {"mapaccess2_fat", funcTag, 88},
121 {"mapassign", funcTag, 79},
122 {"mapassign_fast32", funcTag, 80},
123 {"mapassign_fast32ptr", funcTag, 89},
124 {"mapassign_fast64", funcTag, 81},
125 {"mapassign_fast64ptr", funcTag, 89},
126 {"mapassign_faststr", funcTag, 82},
127 {"mapiterinit", funcTag, 90},
128 {"mapdelete", funcTag, 90},
129 {"mapdelete_fast32", funcTag, 91},
130 {"mapdelete_fast64", funcTag, 92},
131 {"mapdelete_faststr", funcTag, 93},
132 {"mapiternext", funcTag, 94},
133 {"mapclear", funcTag, 95},
134 {"makechan64", funcTag, 97},
135 {"makechan", funcTag, 98},
136 {"chanrecv1", funcTag, 100},
137 {"chanrecv2", funcTag, 101},
138 {"chansend1", funcTag, 103},
139 {"closechan", funcTag, 30},
140 {"writeBarrier", varTag, 105},
141 {"typedmemmove", funcTag, 106},
142 {"typedmemclr", funcTag, 107},
143 {"typedslicecopy", funcTag, 108},
144 {"selectnbsend", funcTag, 109},
145 {"selectnbrecv", funcTag, 110},
146 {"selectsetpc", funcTag, 111},
147 {"selectgo", funcTag, 112},
148 {"block", funcTag, 9},
149 {"makeslice", funcTag, 113},
150 {"makeslice64", funcTag, 114},
151 {"makeslicecopy", funcTag, 115},
152 {"growslice", funcTag, 117},
153 {"unsafeslicecheckptr", funcTag, 118},
154 {"panicunsafeslicelen", funcTag, 9},
155 {"panicunsafeslicenilptr", funcTag, 9},
156 {"unsafestringcheckptr", funcTag, 119},
157 {"panicunsafestringlen", funcTag, 9},
158 {"panicunsafestringnilptr", funcTag, 9},
159 {"memmove", funcTag, 120},
160 {"memclrNoHeapPointers", funcTag, 121},
161 {"memclrHasPointers", funcTag, 121},
162 {"memequal", funcTag, 122},
163 {"memequal0", funcTag, 123},
164 {"memequal8", funcTag, 123},
165 {"memequal16", funcTag, 123},
166 {"memequal32", funcTag, 123},
167 {"memequal64", funcTag, 123},
168 {"memequal128", funcTag, 123},
169 {"f32equal", funcTag, 124},
170 {"f64equal", funcTag, 124},
171 {"c64equal", funcTag, 124},
172 {"c128equal", funcTag, 124},
173 {"strequal", funcTag, 124},
174 {"interequal", funcTag, 124},
175 {"nilinterequal", funcTag, 124},
176 {"memhash", funcTag, 125},
177 {"memhash0", funcTag, 126},
178 {"memhash8", funcTag, 126},
179 {"memhash16", funcTag, 126},
180 {"memhash32", funcTag, 126},
181 {"memhash64", funcTag, 126},
182 {"memhash128", funcTag, 126},
183 {"f32hash", funcTag, 127},
184 {"f64hash", funcTag, 127},
185 {"c64hash", funcTag, 127},
186 {"c128hash", funcTag, 127},
187 {"strhash", funcTag, 127},
188 {"interhash", funcTag, 127},
189 {"nilinterhash", funcTag, 127},
190 {"int64div", funcTag, 128},
191 {"uint64div", funcTag, 129},
192 {"int64mod", funcTag, 128},
193 {"uint64mod", funcTag, 129},
194 {"float64toint64", funcTag, 130},
195 {"float64touint64", funcTag, 131},
196 {"float64touint32", funcTag, 132},
197 {"int64tofloat64", funcTag, 133},
198 {"int64tofloat32", funcTag, 135},
199 {"uint64tofloat64", funcTag, 136},
200 {"uint64tofloat32", funcTag, 137},
201 {"uint32tofloat64", funcTag, 138},
202 {"complex128div", funcTag, 139},
203 {"getcallerpc", funcTag, 140},
204 {"getcallersp", funcTag, 140},
205 {"racefuncenter", funcTag, 31},
206 {"racefuncexit", funcTag, 9},
207 {"raceread", funcTag, 31},
208 {"racewrite", funcTag, 31},
209 {"racereadrange", funcTag, 141},
210 {"racewriterange", funcTag, 141},
211 {"msanread", funcTag, 141},
212 {"msanwrite", funcTag, 141},
213 {"msanmove", funcTag, 142},
214 {"asanread", funcTag, 141},
215 {"asanwrite", funcTag, 141},
216 {"checkptrAlignment", funcTag, 143},
217 {"checkptrArithmetic", funcTag, 145},
218 {"libfuzzerTraceCmp1", funcTag, 146},
219 {"libfuzzerTraceCmp2", funcTag, 147},
220 {"libfuzzerTraceCmp4", funcTag, 148},
221 {"libfuzzerTraceCmp8", funcTag, 149},
222 {"libfuzzerTraceConstCmp1", funcTag, 146},
223 {"libfuzzerTraceConstCmp2", funcTag, 147},
224 {"libfuzzerTraceConstCmp4", funcTag, 148},
225 {"libfuzzerTraceConstCmp8", funcTag, 149},
226 {"libfuzzerHookStrCmp", funcTag, 150},
227 {"libfuzzerHookEqualFold", funcTag, 150},
228 {"addCovMeta", funcTag, 152},
229 {"x86HasPOPCNT", varTag, 6},
230 {"x86HasSSE41", varTag, 6},
231 {"x86HasFMA", varTag, 6},
232 {"armHasVFPv4", varTag, 6},
233 {"arm64HasATOMICS", varTag, 6},
234 {"asanregisterglobals", funcTag, 121},
235 }
236
237 func runtimeTypes() []*types.Type {
238 var typs [153]*types.Type
239 typs[0] = types.ByteType
240 typs[1] = types.NewPtr(typs[0])
241 typs[2] = types.Types[types.TANY]
242 typs[3] = types.NewPtr(typs[2])
243 typs[4] = newSig(params(typs[1]), params(typs[3]))
244 typs[5] = types.Types[types.TUINTPTR]
245 typs[6] = types.Types[types.TBOOL]
246 typs[7] = types.Types[types.TUNSAFEPTR]
247 typs[8] = newSig(params(typs[5], typs[1], typs[6]), params(typs[7]))
248 typs[9] = newSig(nil, nil)
249 typs[10] = types.Types[types.TINTER]
250 typs[11] = newSig(params(typs[10]), nil)
251 typs[12] = types.Types[types.TINT32]
252 typs[13] = types.NewPtr(typs[12])
253 typs[14] = newSig(params(typs[13]), params(typs[10]))
254 typs[15] = types.Types[types.TINT]
255 typs[16] = newSig(params(typs[15], typs[15]), nil)
256 typs[17] = types.Types[types.TUINT]
257 typs[18] = newSig(params(typs[17], typs[15]), nil)
258 typs[19] = newSig(params(typs[6]), nil)
259 typs[20] = types.Types[types.TFLOAT64]
260 typs[21] = newSig(params(typs[20]), nil)
261 typs[22] = types.Types[types.TINT64]
262 typs[23] = newSig(params(typs[22]), nil)
263 typs[24] = types.Types[types.TUINT64]
264 typs[25] = newSig(params(typs[24]), nil)
265 typs[26] = types.Types[types.TCOMPLEX128]
266 typs[27] = newSig(params(typs[26]), nil)
267 typs[28] = types.Types[types.TSTRING]
268 typs[29] = newSig(params(typs[28]), nil)
269 typs[30] = newSig(params(typs[2]), nil)
270 typs[31] = newSig(params(typs[5]), nil)
271 typs[32] = types.NewArray(typs[0], 32)
272 typs[33] = types.NewPtr(typs[32])
273 typs[34] = newSig(params(typs[33], typs[28], typs[28]), params(typs[28]))
274 typs[35] = newSig(params(typs[33], typs[28], typs[28], typs[28]), params(typs[28]))
275 typs[36] = newSig(params(typs[33], typs[28], typs[28], typs[28], typs[28]), params(typs[28]))
276 typs[37] = newSig(params(typs[33], typs[28], typs[28], typs[28], typs[28], typs[28]), params(typs[28]))
277 typs[38] = types.NewSlice(typs[28])
278 typs[39] = newSig(params(typs[33], typs[38]), params(typs[28]))
279 typs[40] = newSig(params(typs[28], typs[28]), params(typs[15]))
280 typs[41] = types.NewArray(typs[0], 4)
281 typs[42] = types.NewPtr(typs[41])
282 typs[43] = newSig(params(typs[42], typs[22]), params(typs[28]))
283 typs[44] = newSig(params(typs[33], typs[1], typs[15]), params(typs[28]))
284 typs[45] = newSig(params(typs[1], typs[15]), params(typs[28]))
285 typs[46] = types.RuneType
286 typs[47] = types.NewSlice(typs[46])
287 typs[48] = newSig(params(typs[33], typs[47]), params(typs[28]))
288 typs[49] = types.NewSlice(typs[0])
289 typs[50] = newSig(params(typs[33], typs[28]), params(typs[49]))
290 typs[51] = types.NewArray(typs[46], 32)
291 typs[52] = types.NewPtr(typs[51])
292 typs[53] = newSig(params(typs[52], typs[28]), params(typs[47]))
293 typs[54] = newSig(params(typs[3], typs[15], typs[3], typs[15], typs[5]), params(typs[15]))
294 typs[55] = newSig(params(typs[28], typs[15]), params(typs[46], typs[15]))
295 typs[56] = newSig(params(typs[28]), params(typs[15]))
296 typs[57] = newSig(params(typs[1], typs[3]), params(typs[7]))
297 typs[58] = types.Types[types.TUINT16]
298 typs[59] = newSig(params(typs[58]), params(typs[7]))
299 typs[60] = types.Types[types.TUINT32]
300 typs[61] = newSig(params(typs[60]), params(typs[7]))
301 typs[62] = newSig(params(typs[24]), params(typs[7]))
302 typs[63] = newSig(params(typs[28]), params(typs[7]))
303 typs[64] = types.Types[types.TUINT8]
304 typs[65] = types.NewSlice(typs[64])
305 typs[66] = newSig(params(typs[65]), params(typs[7]))
306 typs[67] = newSig(params(typs[1], typs[1]), params(typs[1]))
307 typs[68] = newSig(params(typs[1], typs[1], typs[1]), nil)
308 typs[69] = newSig(params(typs[1]), nil)
309 typs[70] = newSig(params(typs[1], typs[1]), params(typs[15], typs[1]))
310 typs[71] = types.NewPtr(typs[5])
311 typs[72] = newSig(params(typs[71], typs[7], typs[7]), params(typs[6]))
312 typs[73] = newSig(nil, params(typs[10]))
313 typs[74] = newSig(nil, params(typs[60]))
314 typs[75] = types.NewMap(typs[2], typs[2])
315 typs[76] = newSig(params(typs[1], typs[22], typs[3]), params(typs[75]))
316 typs[77] = newSig(params(typs[1], typs[15], typs[3]), params(typs[75]))
317 typs[78] = newSig(nil, params(typs[75]))
318 typs[79] = newSig(params(typs[1], typs[75], typs[3]), params(typs[3]))
319 typs[80] = newSig(params(typs[1], typs[75], typs[60]), params(typs[3]))
320 typs[81] = newSig(params(typs[1], typs[75], typs[24]), params(typs[3]))
321 typs[82] = newSig(params(typs[1], typs[75], typs[28]), params(typs[3]))
322 typs[83] = newSig(params(typs[1], typs[75], typs[3], typs[1]), params(typs[3]))
323 typs[84] = newSig(params(typs[1], typs[75], typs[3]), params(typs[3], typs[6]))
324 typs[85] = newSig(params(typs[1], typs[75], typs[60]), params(typs[3], typs[6]))
325 typs[86] = newSig(params(typs[1], typs[75], typs[24]), params(typs[3], typs[6]))
326 typs[87] = newSig(params(typs[1], typs[75], typs[28]), params(typs[3], typs[6]))
327 typs[88] = newSig(params(typs[1], typs[75], typs[3], typs[1]), params(typs[3], typs[6]))
328 typs[89] = newSig(params(typs[1], typs[75], typs[7]), params(typs[3]))
329 typs[90] = newSig(params(typs[1], typs[75], typs[3]), nil)
330 typs[91] = newSig(params(typs[1], typs[75], typs[60]), nil)
331 typs[92] = newSig(params(typs[1], typs[75], typs[24]), nil)
332 typs[93] = newSig(params(typs[1], typs[75], typs[28]), nil)
333 typs[94] = newSig(params(typs[3]), nil)
334 typs[95] = newSig(params(typs[1], typs[75]), nil)
335 typs[96] = types.NewChan(typs[2], types.Cboth)
336 typs[97] = newSig(params(typs[1], typs[22]), params(typs[96]))
337 typs[98] = newSig(params(typs[1], typs[15]), params(typs[96]))
338 typs[99] = types.NewChan(typs[2], types.Crecv)
339 typs[100] = newSig(params(typs[99], typs[3]), nil)
340 typs[101] = newSig(params(typs[99], typs[3]), params(typs[6]))
341 typs[102] = types.NewChan(typs[2], types.Csend)
342 typs[103] = newSig(params(typs[102], typs[3]), nil)
343 typs[104] = types.NewArray(typs[0], 3)
344 typs[105] = types.NewStruct([]*types.Field{types.NewField(src.NoXPos, Lookup("enabled"), typs[6]), types.NewField(src.NoXPos, Lookup("pad"), typs[104]), types.NewField(src.NoXPos, Lookup("cgo"), typs[6]), types.NewField(src.NoXPos, Lookup("alignme"), typs[24])})
345 typs[106] = newSig(params(typs[1], typs[3], typs[3]), nil)
346 typs[107] = newSig(params(typs[1], typs[3]), nil)
347 typs[108] = newSig(params(typs[1], typs[3], typs[15], typs[3], typs[15]), params(typs[15]))
348 typs[109] = newSig(params(typs[102], typs[3]), params(typs[6]))
349 typs[110] = newSig(params(typs[3], typs[99]), params(typs[6], typs[6]))
350 typs[111] = newSig(params(typs[71]), nil)
351 typs[112] = newSig(params(typs[1], typs[1], typs[71], typs[15], typs[15], typs[6]), params(typs[15], typs[6]))
352 typs[113] = newSig(params(typs[1], typs[15], typs[15]), params(typs[7]))
353 typs[114] = newSig(params(typs[1], typs[22], typs[22]), params(typs[7]))
354 typs[115] = newSig(params(typs[1], typs[15], typs[15], typs[7]), params(typs[7]))
355 typs[116] = types.NewSlice(typs[2])
356 typs[117] = newSig(params(typs[3], typs[15], typs[15], typs[15], typs[1]), params(typs[116]))
357 typs[118] = newSig(params(typs[1], typs[7], typs[22]), nil)
358 typs[119] = newSig(params(typs[7], typs[22]), nil)
359 typs[120] = newSig(params(typs[3], typs[3], typs[5]), nil)
360 typs[121] = newSig(params(typs[7], typs[5]), nil)
361 typs[122] = newSig(params(typs[3], typs[3], typs[5]), params(typs[6]))
362 typs[123] = newSig(params(typs[3], typs[3]), params(typs[6]))
363 typs[124] = newSig(params(typs[7], typs[7]), params(typs[6]))
364 typs[125] = newSig(params(typs[3], typs[5], typs[5]), params(typs[5]))
365 typs[126] = newSig(params(typs[7], typs[5]), params(typs[5]))
366 typs[127] = newSig(params(typs[3], typs[5]), params(typs[5]))
367 typs[128] = newSig(params(typs[22], typs[22]), params(typs[22]))
368 typs[129] = newSig(params(typs[24], typs[24]), params(typs[24]))
369 typs[130] = newSig(params(typs[20]), params(typs[22]))
370 typs[131] = newSig(params(typs[20]), params(typs[24]))
371 typs[132] = newSig(params(typs[20]), params(typs[60]))
372 typs[133] = newSig(params(typs[22]), params(typs[20]))
373 typs[134] = types.Types[types.TFLOAT32]
374 typs[135] = newSig(params(typs[22]), params(typs[134]))
375 typs[136] = newSig(params(typs[24]), params(typs[20]))
376 typs[137] = newSig(params(typs[24]), params(typs[134]))
377 typs[138] = newSig(params(typs[60]), params(typs[20]))
378 typs[139] = newSig(params(typs[26], typs[26]), params(typs[26]))
379 typs[140] = newSig(nil, params(typs[5]))
380 typs[141] = newSig(params(typs[5], typs[5]), nil)
381 typs[142] = newSig(params(typs[5], typs[5], typs[5]), nil)
382 typs[143] = newSig(params(typs[7], typs[1], typs[5]), nil)
383 typs[144] = types.NewSlice(typs[7])
384 typs[145] = newSig(params(typs[7], typs[144]), nil)
385 typs[146] = newSig(params(typs[64], typs[64], typs[17]), nil)
386 typs[147] = newSig(params(typs[58], typs[58], typs[17]), nil)
387 typs[148] = newSig(params(typs[60], typs[60], typs[17]), nil)
388 typs[149] = newSig(params(typs[24], typs[24], typs[17]), nil)
389 typs[150] = newSig(params(typs[28], typs[28], typs[17]), nil)
390 typs[151] = types.NewArray(typs[0], 16)
391 typs[152] = newSig(params(typs[7], typs[60], typs[151], typs[28], typs[15], typs[64], typs[64]), params(typs[60]))
392 return typs[:]
393 }
394
395 var coverageDecls = [...]struct {
396 name string
397 tag int
398 typ int
399 }{
400 {"initHook", funcTag, 1},
401 }
402
403 func coverageTypes() []*types.Type {
404 var typs [2]*types.Type
405 typs[0] = types.Types[types.TBOOL]
406 typs[1] = newSig(params(typs[0]), nil)
407 return typs[:]
408 }
409
View as plain text