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// in cmd/compile/internal/typecheck 7// to update builtin.go. This is not done automatically 8// to avoid depending on having a working compiler binary. 9 10//go: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// Convert non-interface type to the data word of a (empty or nonempty) interface. 87func convT(typ *byte, elem *any) unsafe.Pointer 88 89// Same as convT, for types with no pointers in them. 90func convTnoptr(typ *byte, elem *any) unsafe.Pointer 91 92// Specialized versions of convT for specific types. 93// These functions take concrete types in the runtime. But they may 94// be used for a wider range of types, which have the same memory 95// layout as the parameter type. The compiler converts the 96// to-be-converted type to the parameter type before calling the 97// runtime function. This way, the call is ABI-insensitive. 98func convT16(val uint16) unsafe.Pointer 99func convT32(val uint32) unsafe.Pointer 100func convT64(val uint64) unsafe.Pointer 101func convTstring(val string) unsafe.Pointer 102func convTslice(val []uint8) unsafe.Pointer 103 104// interface type assertions x.(T) 105func assertE2I(inter *byte, typ *byte) *byte 106func assertE2I2(inter *byte, typ *byte) *byte 107func panicdottypeE(have, want, iface *byte) 108func panicdottypeI(have, want, iface *byte) 109func panicnildottype(want *byte) 110func typeAssert(s *byte, typ *byte) *byte 111 112// interface switches 113func interfaceSwitch(s *byte, t *byte) (int, *byte) 114 115// interface equality. Type/itab pointers are already known to be equal, so 116// we only need to pass one. 117func ifaceeq(tab *uintptr, x, y unsafe.Pointer) (ret bool) 118func efaceeq(typ *uintptr, x, y unsafe.Pointer) (ret bool) 119 120// panic for various rangefunc iterator errors 121func panicrangestate(state int) 122 123// defer in range over func 124func deferrangefunc() interface{} 125 126func rand32() uint32 127 128// *byte is really *runtime.Type 129func makemap64(mapType *byte, hint int64, mapbuf *any) (hmap map[any]any) 130func makemap(mapType *byte, hint int, mapbuf *any) (hmap map[any]any) 131func makemap_small() (hmap map[any]any) 132func mapaccess1(mapType *byte, hmap map[any]any, key *any) (val *any) 133func mapaccess1_fast32(mapType *byte, hmap map[any]any, key uint32) (val *any) 134func mapaccess1_fast64(mapType *byte, hmap map[any]any, key uint64) (val *any) 135func mapaccess1_faststr(mapType *byte, hmap map[any]any, key string) (val *any) 136func mapaccess1_fat(mapType *byte, hmap map[any]any, key *any, zero *byte) (val *any) 137func mapaccess2(mapType *byte, hmap map[any]any, key *any) (val *any, pres bool) 138func mapaccess2_fast32(mapType *byte, hmap map[any]any, key uint32) (val *any, pres bool) 139func mapaccess2_fast64(mapType *byte, hmap map[any]any, key uint64) (val *any, pres bool) 140func mapaccess2_faststr(mapType *byte, hmap map[any]any, key string) (val *any, pres bool) 141func mapaccess2_fat(mapType *byte, hmap map[any]any, key *any, zero *byte) (val *any, pres bool) 142func mapassign(mapType *byte, hmap map[any]any, key *any) (val *any) 143func mapassign_fast32(mapType *byte, hmap map[any]any, key uint32) (val *any) 144func mapassign_fast32ptr(mapType *byte, hmap map[any]any, key unsafe.Pointer) (val *any) 145func mapassign_fast64(mapType *byte, hmap map[any]any, key uint64) (val *any) 146func mapassign_fast64ptr(mapType *byte, hmap map[any]any, key unsafe.Pointer) (val *any) 147func mapassign_faststr(mapType *byte, hmap map[any]any, key string) (val *any) 148func mapiterinit(mapType *byte, hmap map[any]any, hiter *any) 149func mapdelete(mapType *byte, hmap map[any]any, key *any) 150func mapdelete_fast32(mapType *byte, hmap map[any]any, key uint32) 151func mapdelete_fast64(mapType *byte, hmap map[any]any, key uint64) 152func mapdelete_faststr(mapType *byte, hmap map[any]any, key string) 153func mapiternext(hiter *any) 154func mapclear(mapType *byte, hmap map[any]any) 155 156// *byte is really *runtime.Type 157func makechan64(chanType *byte, size int64) (hchan chan any) 158func makechan(chanType *byte, size int) (hchan chan any) 159func chanrecv1(hchan <-chan any, elem *any) 160func chanrecv2(hchan <-chan any, elem *any) bool 161func chansend1(hchan chan<- any, elem *any) 162func closechan(hchan chan<- any) 163func chanlen(hchan any) int 164func chancap(hchan any) int 165 166var writeBarrier struct { 167 enabled bool 168 pad [3]byte 169 cgo bool 170 alignme uint64 171} 172 173// *byte is really *runtime.Type 174func typedmemmove(typ *byte, dst *any, src *any) 175func typedmemclr(typ *byte, dst *any) 176func typedslicecopy(typ *byte, dstPtr *any, dstLen int, srcPtr *any, srcLen int) int 177 178func selectnbsend(hchan chan<- any, elem *any) bool 179func selectnbrecv(elem *any, hchan <-chan any) (bool, bool) 180 181func selectsetpc(pc *uintptr) 182func selectgo(cas0 *byte, order0 *byte, pc0 *uintptr, nsends int, nrecvs int, block bool) (int, bool) 183func block() 184 185func makeslice(typ *byte, len int, cap int) unsafe.Pointer 186func makeslice64(typ *byte, len int64, cap int64) unsafe.Pointer 187func makeslicecopy(typ *byte, tolen int, fromlen int, from unsafe.Pointer) unsafe.Pointer 188func growslice(oldPtr *any, newLen, oldCap, num int, et *byte) (ary []any) 189func unsafeslicecheckptr(typ *byte, ptr unsafe.Pointer, len int64) 190func panicunsafeslicelen() 191func panicunsafeslicenilptr() 192func unsafestringcheckptr(ptr unsafe.Pointer, len int64) 193func panicunsafestringlen() 194func panicunsafestringnilptr() 195 196func memmove(to *any, frm *any, length uintptr) 197func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) 198func memclrHasPointers(ptr unsafe.Pointer, n uintptr) 199 200func memequal(x, y *any, size uintptr) bool 201func memequal0(x, y *any) bool 202func memequal8(x, y *any) bool 203func memequal16(x, y *any) bool 204func memequal32(x, y *any) bool 205func memequal64(x, y *any) bool 206func memequal128(x, y *any) bool 207func f32equal(p, q unsafe.Pointer) bool 208func f64equal(p, q unsafe.Pointer) bool 209func c64equal(p, q unsafe.Pointer) bool 210func c128equal(p, q unsafe.Pointer) bool 211func strequal(p, q unsafe.Pointer) bool 212func interequal(p, q unsafe.Pointer) bool 213func nilinterequal(p, q unsafe.Pointer) bool 214 215func memhash(x *any, h uintptr, size uintptr) uintptr 216func memhash0(p unsafe.Pointer, h uintptr) uintptr 217func memhash8(p unsafe.Pointer, h uintptr) uintptr 218func memhash16(p unsafe.Pointer, h uintptr) uintptr 219func memhash32(p unsafe.Pointer, h uintptr) uintptr 220func memhash64(p unsafe.Pointer, h uintptr) uintptr 221func memhash128(p unsafe.Pointer, h uintptr) uintptr 222func f32hash(p *any, h uintptr) uintptr 223func f64hash(p *any, h uintptr) uintptr 224func c64hash(p *any, h uintptr) uintptr 225func c128hash(p *any, h uintptr) uintptr 226func strhash(a *any, h uintptr) uintptr 227func interhash(p *any, h uintptr) uintptr 228func nilinterhash(p *any, h uintptr) uintptr 229 230// only used on 32-bit 231func int64div(int64, int64) int64 232func uint64div(uint64, uint64) uint64 233func int64mod(int64, int64) int64 234func uint64mod(uint64, uint64) uint64 235func float64toint64(float64) int64 236func float64touint64(float64) uint64 237func float64touint32(float64) uint32 238func int64tofloat64(int64) float64 239func int64tofloat32(int64) float32 240func uint64tofloat64(uint64) float64 241func uint64tofloat32(uint64) float32 242func uint32tofloat64(uint32) float64 243 244func complex128div(num complex128, den complex128) (quo complex128) 245 246func getcallerpc() uintptr 247func getcallersp() uintptr 248 249// race detection 250func racefuncenter(uintptr) 251func racefuncexit() 252func raceread(uintptr) 253func racewrite(uintptr) 254func racereadrange(addr, size uintptr) 255func racewriterange(addr, size uintptr) 256 257// memory sanitizer 258func msanread(addr, size uintptr) 259func msanwrite(addr, size uintptr) 260func msanmove(dst, src, size uintptr) 261 262// address sanitizer 263func asanread(addr, size uintptr) 264func asanwrite(addr, size uintptr) 265 266func checkptrAlignment(unsafe.Pointer, *byte, uintptr) 267func checkptrArithmetic(unsafe.Pointer, []unsafe.Pointer) 268 269func libfuzzerTraceCmp1(uint8, uint8, uint) 270func libfuzzerTraceCmp2(uint16, uint16, uint) 271func libfuzzerTraceCmp4(uint32, uint32, uint) 272func libfuzzerTraceCmp8(uint64, uint64, uint) 273func libfuzzerTraceConstCmp1(uint8, uint8, uint) 274func libfuzzerTraceConstCmp2(uint16, uint16, uint) 275func libfuzzerTraceConstCmp4(uint32, uint32, uint) 276func libfuzzerTraceConstCmp8(uint64, uint64, uint) 277func libfuzzerHookStrCmp(string, string, uint) 278func libfuzzerHookEqualFold(string, string, uint) 279 280func addCovMeta(p unsafe.Pointer, len uint32, hash [16]byte, pkpath string, pkgId int, cmode uint8, cgran uint8) uint32 281 282// architecture variants 283var x86HasPOPCNT bool 284var x86HasSSE41 bool 285var x86HasFMA bool 286var armHasVFPv4 bool 287var arm64HasATOMICS bool 288 289func asanregisterglobals(unsafe.Pointer, uintptr) 290