1// Copyright 2009 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// NOTE: If you change this file you must run "go generate"
6// to update builtin.go. This is not done automatically
7// to avoid depending on having a working compiler binary.
8
9//go:build ignore
10// +build ignore
11
12package runtime
13
14// emitted by compiler, not referred to by go programs
15
16import "unsafe"
17
18func newobject(typ *byte) *any
19func mallocgc(size uintptr, typ *byte, needszero bool) unsafe.Pointer
20func panicdivide()
21func panicshift()
22func panicmakeslicelen()
23func panicmakeslicecap()
24func throwinit()
25func panicwrap()
26
27func gopanic(interface{})
28func gorecover(*int32) interface{}
29func goschedguarded()
30
31// Note: these declarations are just for wasm port.
32// Other ports call assembly stubs instead.
33func goPanicIndex(x int, y int)
34func goPanicIndexU(x uint, y int)
35func goPanicSliceAlen(x int, y int)
36func goPanicSliceAlenU(x uint, y int)
37func goPanicSliceAcap(x int, y int)
38func goPanicSliceAcapU(x uint, y int)
39func goPanicSliceB(x int, y int)
40func goPanicSliceBU(x uint, y int)
41func goPanicSlice3Alen(x int, y int)
42func goPanicSlice3AlenU(x uint, y int)
43func goPanicSlice3Acap(x int, y int)
44func goPanicSlice3AcapU(x uint, y int)
45func goPanicSlice3B(x int, y int)
46func goPanicSlice3BU(x uint, y int)
47func goPanicSlice3C(x int, y int)
48func goPanicSlice3CU(x uint, y int)
49func goPanicSliceConvert(x int, y int)
50
51func printbool(bool)
52func printfloat(float64)
53func printint(int64)
54func printhex(uint64)
55func printuint(uint64)
56func printcomplex(complex128)
57func printstring(string)
58func printpointer(any)
59func printuintptr(uintptr)
60func printiface(any)
61func printeface(any)
62func printslice(any)
63func printnl()
64func printsp()
65func printlock()
66func printunlock()
67
68func concatstring2(*[32]byte, string, string) string
69func concatstring3(*[32]byte, string, string, string) string
70func concatstring4(*[32]byte, string, string, string, string) string
71func concatstring5(*[32]byte, string, string, string, string, string) string
72func concatstrings(*[32]byte, []string) string
73
74func cmpstring(string, string) int
75func intstring(*[4]byte, int64) string
76func slicebytetostring(buf *[32]byte, ptr *byte, n int) string
77func slicebytetostringtmp(ptr *byte, n int) string
78func slicerunetostring(*[32]byte, []rune) string
79func stringtoslicebyte(*[32]byte, string) []byte
80func stringtoslicerune(*[32]rune, string) []rune
81func slicecopy(toPtr *any, toLen int, fromPtr *any, fromLen int, wid uintptr) int
82
83func decoderune(string, int) (retv rune, retk int)
84func countrunes(string) int
85
86// Non-empty-interface to non-empty-interface conversion.
87func convI2I(typ *byte, itab *uintptr) (ret *uintptr)
88
89// Convert non-interface type to the data word of a (empty or nonempty) interface.
90func convT(typ *byte, elem *any) unsafe.Pointer
91
92// Same as convT, for types with no pointers in them.
93func convTnoptr(typ *byte, elem *any) unsafe.Pointer
94
95// Specialized versions of convT for specific types.
96// These functions take concrete types in the runtime. But they may
97// be used for a wider range of types, which have the same memory
98// layout as the parameter type. The compiler converts the
99// to-be-converted type to the parameter type before calling the
100// runtime function. This way, the call is ABI-insensitive.
101func convT16(val uint16) unsafe.Pointer
102func convT32(val uint32) unsafe.Pointer
103func convT64(val uint64) unsafe.Pointer
104func convTstring(val string) unsafe.Pointer
105func convTslice(val []uint8) unsafe.Pointer
106
107// interface type assertions x.(T)
108func assertE2I(inter *byte, typ *byte) *byte
109func assertE2I2(inter *byte, eface any) (ret any)
110func assertI2I(inter *byte, tab *byte) *byte
111func assertI2I2(inter *byte, iface any) (ret any)
112func panicdottypeE(have, want, iface *byte)
113func panicdottypeI(have, want, iface *byte)
114func panicnildottype(want *byte)
115
116// interface equality. Type/itab pointers are already known to be equal, so
117// we only need to pass one.
118func ifaceeq(tab *uintptr, x, y unsafe.Pointer) (ret bool)
119func efaceeq(typ *uintptr, x, y unsafe.Pointer) (ret bool)
120
121func fastrand() uint32
122
123// *byte is really *runtime.Type
124func makemap64(mapType *byte, hint int64, mapbuf *any) (hmap map[any]any)
125func makemap(mapType *byte, hint int, mapbuf *any) (hmap map[any]any)
126func makemap_small() (hmap map[any]any)
127func mapaccess1(mapType *byte, hmap map[any]any, key *any) (val *any)
128func mapaccess1_fast32(mapType *byte, hmap map[any]any, key uint32) (val *any)
129func mapaccess1_fast64(mapType *byte, hmap map[any]any, key uint64) (val *any)
130func mapaccess1_faststr(mapType *byte, hmap map[any]any, key string) (val *any)
131func mapaccess1_fat(mapType *byte, hmap map[any]any, key *any, zero *byte) (val *any)
132func mapaccess2(mapType *byte, hmap map[any]any, key *any) (val *any, pres bool)
133func mapaccess2_fast32(mapType *byte, hmap map[any]any, key uint32) (val *any, pres bool)
134func mapaccess2_fast64(mapType *byte, hmap map[any]any, key uint64) (val *any, pres bool)
135func mapaccess2_faststr(mapType *byte, hmap map[any]any, key string) (val *any, pres bool)
136func mapaccess2_fat(mapType *byte, hmap map[any]any, key *any, zero *byte) (val *any, pres bool)
137func mapassign(mapType *byte, hmap map[any]any, key *any) (val *any)
138func mapassign_fast32(mapType *byte, hmap map[any]any, key uint32) (val *any)
139func mapassign_fast32ptr(mapType *byte, hmap map[any]any, key unsafe.Pointer) (val *any)
140func mapassign_fast64(mapType *byte, hmap map[any]any, key uint64) (val *any)
141func mapassign_fast64ptr(mapType *byte, hmap map[any]any, key unsafe.Pointer) (val *any)
142func mapassign_faststr(mapType *byte, hmap map[any]any, key string) (val *any)
143func mapiterinit(mapType *byte, hmap map[any]any, hiter *any)
144func mapdelete(mapType *byte, hmap map[any]any, key *any)
145func mapdelete_fast32(mapType *byte, hmap map[any]any, key uint32)
146func mapdelete_fast64(mapType *byte, hmap map[any]any, key uint64)
147func mapdelete_faststr(mapType *byte, hmap map[any]any, key string)
148func mapiternext(hiter *any)
149func mapclear(mapType *byte, hmap map[any]any)
150
151// *byte is really *runtime.Type
152func makechan64(chanType *byte, size int64) (hchan chan any)
153func makechan(chanType *byte, size int) (hchan chan any)
154func chanrecv1(hchan <-chan any, elem *any)
155func chanrecv2(hchan <-chan any, elem *any) bool
156func chansend1(hchan chan<- any, elem *any)
157func closechan(hchan any)
158
159var writeBarrier struct {
160	enabled bool
161	pad     [3]byte
162	needed  bool
163	cgo     bool
164	alignme uint64
165}
166
167// *byte is really *runtime.Type
168func typedmemmove(typ *byte, dst *any, src *any)
169func typedmemclr(typ *byte, dst *any)
170func typedslicecopy(typ *byte, dstPtr *any, dstLen int, srcPtr *any, srcLen int) int
171
172func selectnbsend(hchan chan<- any, elem *any) bool
173func selectnbrecv(elem *any, hchan <-chan any) (bool, bool)
174
175func selectsetpc(pc *uintptr)
176func selectgo(cas0 *byte, order0 *byte, pc0 *uintptr, nsends int, nrecvs int, block bool) (int, bool)
177func block()
178
179func makeslice(typ *byte, len int, cap int) unsafe.Pointer
180func makeslice64(typ *byte, len int64, cap int64) unsafe.Pointer
181func makeslicecopy(typ *byte, tolen int, fromlen int, from unsafe.Pointer) unsafe.Pointer
182func growslice(typ *byte, old []any, cap int) (ary []any)
183func unsafeslice(typ *byte, ptr unsafe.Pointer, len int)
184func unsafeslice64(typ *byte, ptr unsafe.Pointer, len int64)
185func unsafeslicecheckptr(typ *byte, ptr unsafe.Pointer, len int64)
186
187func memmove(to *any, frm *any, length uintptr)
188func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
189func memclrHasPointers(ptr unsafe.Pointer, n uintptr)
190
191func memequal(x, y *any, size uintptr) bool
192func memequal0(x, y *any) bool
193func memequal8(x, y *any) bool
194func memequal16(x, y *any) bool
195func memequal32(x, y *any) bool
196func memequal64(x, y *any) bool
197func memequal128(x, y *any) bool
198func f32equal(p, q unsafe.Pointer) bool
199func f64equal(p, q unsafe.Pointer) bool
200func c64equal(p, q unsafe.Pointer) bool
201func c128equal(p, q unsafe.Pointer) bool
202func strequal(p, q unsafe.Pointer) bool
203func interequal(p, q unsafe.Pointer) bool
204func nilinterequal(p, q unsafe.Pointer) bool
205
206func memhash(p unsafe.Pointer, h uintptr, size uintptr) uintptr
207func memhash0(p unsafe.Pointer, h uintptr) uintptr
208func memhash8(p unsafe.Pointer, h uintptr) uintptr
209func memhash16(p unsafe.Pointer, h uintptr) uintptr
210func memhash32(p unsafe.Pointer, h uintptr) uintptr
211func memhash64(p unsafe.Pointer, h uintptr) uintptr
212func memhash128(p unsafe.Pointer, h uintptr) uintptr
213func f32hash(p unsafe.Pointer, h uintptr) uintptr
214func f64hash(p unsafe.Pointer, h uintptr) uintptr
215func c64hash(p unsafe.Pointer, h uintptr) uintptr
216func c128hash(p unsafe.Pointer, h uintptr) uintptr
217func strhash(a unsafe.Pointer, h uintptr) uintptr
218func interhash(p unsafe.Pointer, h uintptr) uintptr
219func nilinterhash(p unsafe.Pointer, h uintptr) uintptr
220
221// only used on 32-bit
222func int64div(int64, int64) int64
223func uint64div(uint64, uint64) uint64
224func int64mod(int64, int64) int64
225func uint64mod(uint64, uint64) uint64
226func float64toint64(float64) int64
227func float64touint64(float64) uint64
228func float64touint32(float64) uint32
229func int64tofloat64(int64) float64
230func int64tofloat32(int64) float32
231func uint64tofloat64(uint64) float64
232func uint64tofloat32(uint64) float32
233func uint32tofloat64(uint32) float64
234
235func complex128div(num complex128, den complex128) (quo complex128)
236
237func getcallerpc() uintptr
238func getcallersp() uintptr
239
240// race detection
241func racefuncenter(uintptr)
242func racefuncexit()
243func raceread(uintptr)
244func racewrite(uintptr)
245func racereadrange(addr, size uintptr)
246func racewriterange(addr, size uintptr)
247
248// memory sanitizer
249func msanread(addr, size uintptr)
250func msanwrite(addr, size uintptr)
251func msanmove(dst, src, size uintptr)
252
253// address sanitizer
254func asanread(addr, size uintptr)
255func asanwrite(addr, size uintptr)
256
257func checkptrAlignment(unsafe.Pointer, *byte, uintptr)
258func checkptrArithmetic(unsafe.Pointer, []unsafe.Pointer)
259
260func libfuzzerTraceCmp1(uint8, uint8)
261func libfuzzerTraceCmp2(uint16, uint16)
262func libfuzzerTraceCmp4(uint32, uint32)
263func libfuzzerTraceCmp8(uint64, uint64)
264func libfuzzerTraceConstCmp1(uint8, uint8)
265func libfuzzerTraceConstCmp2(uint16, uint16)
266func libfuzzerTraceConstCmp4(uint32, uint32)
267func libfuzzerTraceConstCmp8(uint64, uint64)
268
269// architecture variants
270var x86HasPOPCNT bool
271var x86HasSSE41 bool
272var x86HasFMA bool
273var armHasVFPv4 bool
274var arm64HasATOMICS bool
275