Source file src/cmd/compile/internal/typecheck/_builtin/runtime.go

     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  
    12  package runtime
    13  
    14  // emitted by compiler, not referred to by go programs
    15  
    16  import "unsafe"
    17  
    18  func newobject(typ *byte) *any
    19  func mallocgc(size uintptr, typ *byte, needszero bool) unsafe.Pointer
    20  func panicdivide()
    21  func panicshift()
    22  func panicmakeslicelen()
    23  func panicmakeslicecap()
    24  func throwinit()
    25  func panicwrap()
    26  
    27  func gopanic(interface{})
    28  func gorecover() interface{}
    29  func goschedguarded()
    30  
    31  // Note: these declarations are just for wasm port.
    32  // Other ports call assembly stubs instead.
    33  func goPanicIndex(x int, y int)
    34  func goPanicIndexU(x uint, y int)
    35  func goPanicSliceAlen(x int, y int)
    36  func goPanicSliceAlenU(x uint, y int)
    37  func goPanicSliceAcap(x int, y int)
    38  func goPanicSliceAcapU(x uint, y int)
    39  func goPanicSliceB(x int, y int)
    40  func goPanicSliceBU(x uint, y int)
    41  func goPanicSlice3Alen(x int, y int)
    42  func goPanicSlice3AlenU(x uint, y int)
    43  func goPanicSlice3Acap(x int, y int)
    44  func goPanicSlice3AcapU(x uint, y int)
    45  func goPanicSlice3B(x int, y int)
    46  func goPanicSlice3BU(x uint, y int)
    47  func goPanicSlice3C(x int, y int)
    48  func goPanicSlice3CU(x uint, y int)
    49  func goPanicSliceConvert(x int, y int)
    50  
    51  func printbool(bool)
    52  func printfloat64(float64)
    53  func printfloat32(float32)
    54  func printint(int64)
    55  func printhex(uint64)
    56  func printuint(uint64)
    57  func printcomplex128(complex128)
    58  func printcomplex64(complex64)
    59  func printstring(string)
    60  func printquoted(string)
    61  func printpointer(any)
    62  func printuintptr(uintptr)
    63  func printiface(any)
    64  func printeface(any)
    65  func printslice(any)
    66  func printnl()
    67  func printsp()
    68  func printlock()
    69  func printunlock()
    70  
    71  func concatstring2(*[32]byte, string, string) string
    72  func concatstring3(*[32]byte, string, string, string) string
    73  func concatstring4(*[32]byte, string, string, string, string) string
    74  func concatstring5(*[32]byte, string, string, string, string, string) string
    75  func concatstrings(*[32]byte, []string) string
    76  
    77  func concatbyte2(*[32]byte, string, string) []byte
    78  func concatbyte3(*[32]byte, string, string, string) []byte
    79  func concatbyte4(*[32]byte, string, string, string, string) []byte
    80  func concatbyte5(*[32]byte, string, string, string, string, string) []byte
    81  func concatbytes(*[32]byte, []string) []byte
    82  
    83  func cmpstring(string, string) int
    84  func intstring(*[4]byte, int64) string
    85  func slicebytetostring(buf *[32]byte, ptr *byte, n int) string
    86  func slicebytetostringtmp(ptr *byte, n int) string
    87  func slicerunetostring(*[32]byte, []rune) string
    88  func stringtoslicebyte(*[32]byte, string) []byte
    89  func stringtoslicerune(*[32]rune, string) []rune
    90  func slicecopy(toPtr *any, toLen int, fromPtr *any, fromLen int, wid uintptr) int
    91  
    92  func decoderune(string, int) (retv rune, retk int)
    93  func countrunes(string) int
    94  
    95  // Convert non-interface type to the data word of a (empty or nonempty) interface.
    96  func convT(typ *byte, elem *any) unsafe.Pointer
    97  
    98  // Same as convT, for types with no pointers in them.
    99  func convTnoptr(typ *byte, elem *any) unsafe.Pointer
   100  
   101  // Specialized versions of convT for specific types.
   102  // These functions take concrete types in the runtime. But they may
   103  // be used for a wider range of types, which have the same memory
   104  // layout as the parameter type. The compiler converts the
   105  // to-be-converted type to the parameter type before calling the
   106  // runtime function. This way, the call is ABI-insensitive.
   107  func convT16(val uint16) unsafe.Pointer
   108  func convT32(val uint32) unsafe.Pointer
   109  func convT64(val uint64) unsafe.Pointer
   110  func convTstring(val string) unsafe.Pointer
   111  func convTslice(val []uint8) unsafe.Pointer
   112  
   113  // interface type assertions x.(T)
   114  func assertE2I(inter *byte, typ *byte) *byte
   115  func assertE2I2(inter *byte, typ *byte) *byte
   116  func panicdottypeE(have, want, iface *byte)
   117  func panicdottypeI(have, want, iface *byte)
   118  func panicnildottype(want *byte)
   119  func typeAssert(s *byte, typ *byte) *byte
   120  
   121  // interface switches
   122  func interfaceSwitch(s *byte, t *byte) (int, *byte)
   123  
   124  // interface equality. Type/itab pointers are already known to be equal, so
   125  // we only need to pass one.
   126  func ifaceeq(tab *uintptr, x, y unsafe.Pointer) (ret bool)
   127  func efaceeq(typ *uintptr, x, y unsafe.Pointer) (ret bool)
   128  
   129  // panic for various rangefunc iterator errors
   130  func panicrangestate(state int)
   131  
   132  // defer in range over func
   133  func deferrangefunc() interface{}
   134  
   135  func rand() uint64
   136  func rand32() uint32
   137  
   138  // *byte is really *runtime.Type
   139  func makemap64(mapType *byte, hint int64, mapbuf *any) (hmap map[any]any)
   140  func makemap(mapType *byte, hint int, mapbuf *any) (hmap map[any]any)
   141  func makemap_small() (hmap map[any]any)
   142  func mapaccess1(mapType *byte, hmap map[any]any, key *any) (val *any)
   143  func mapaccess1_fast32(mapType *byte, hmap map[any]any, key uint32) (val *any)
   144  func mapaccess1_fast64(mapType *byte, hmap map[any]any, key uint64) (val *any)
   145  func mapaccess1_faststr(mapType *byte, hmap map[any]any, key string) (val *any)
   146  func mapaccess1_fat(mapType *byte, hmap map[any]any, key *any, zero *byte) (val *any)
   147  func mapaccess2(mapType *byte, hmap map[any]any, key *any) (val *any, pres bool)
   148  func mapaccess2_fast32(mapType *byte, hmap map[any]any, key uint32) (val *any, pres bool)
   149  func mapaccess2_fast64(mapType *byte, hmap map[any]any, key uint64) (val *any, pres bool)
   150  func mapaccess2_faststr(mapType *byte, hmap map[any]any, key string) (val *any, pres bool)
   151  func mapaccess2_fat(mapType *byte, hmap map[any]any, key *any, zero *byte) (val *any, pres bool)
   152  func mapassign(mapType *byte, hmap map[any]any, key *any) (val *any)
   153  func mapassign_fast32(mapType *byte, hmap map[any]any, key uint32) (val *any)
   154  func mapassign_fast32ptr(mapType *byte, hmap map[any]any, key unsafe.Pointer) (val *any)
   155  func mapassign_fast64(mapType *byte, hmap map[any]any, key uint64) (val *any)
   156  func mapassign_fast64ptr(mapType *byte, hmap map[any]any, key unsafe.Pointer) (val *any)
   157  func mapassign_faststr(mapType *byte, hmap map[any]any, key string) (val *any)
   158  func mapIterStart(mapType *byte, hmap map[any]any, hiter *any)
   159  func mapdelete(mapType *byte, hmap map[any]any, key *any)
   160  func mapdelete_fast32(mapType *byte, hmap map[any]any, key uint32)
   161  func mapdelete_fast64(mapType *byte, hmap map[any]any, key uint64)
   162  func mapdelete_faststr(mapType *byte, hmap map[any]any, key string)
   163  func mapIterNext(hiter *any)
   164  func mapclear(mapType *byte, hmap map[any]any)
   165  
   166  // *byte is really *runtime.Type
   167  func makechan64(chanType *byte, size int64) (hchan chan any)
   168  func makechan(chanType *byte, size int) (hchan chan any)
   169  func chanrecv1(hchan <-chan any, elem *any)
   170  func chanrecv2(hchan <-chan any, elem *any) bool
   171  func chansend1(hchan chan<- any, elem *any)
   172  func closechan(hchan chan<- any)
   173  func chanlen(hchan any) int
   174  func chancap(hchan any) int
   175  
   176  var writeBarrier struct {
   177  	enabled bool
   178  	pad     [3]byte
   179  	cgo     bool
   180  	alignme uint64
   181  }
   182  
   183  // *byte is really *runtime.Type
   184  func typedmemmove(typ *byte, dst *any, src *any)
   185  func typedmemclr(typ *byte, dst *any)
   186  func typedslicecopy(typ *byte, dstPtr *any, dstLen int, srcPtr *any, srcLen int) int
   187  
   188  func selectnbsend(hchan chan<- any, elem *any) bool
   189  func selectnbrecv(elem *any, hchan <-chan any) (bool, bool)
   190  
   191  func selectsetpc(pc *uintptr)
   192  func selectgo(cas0 *byte, order0 *byte, pc0 *uintptr, nsends int, nrecvs int, block bool) (int, bool)
   193  func block()
   194  
   195  func makeslice(typ *byte, len int, cap int) unsafe.Pointer
   196  func makeslice64(typ *byte, len int64, cap int64) unsafe.Pointer
   197  func makeslicecopy(typ *byte, tolen int, fromlen int, from unsafe.Pointer) unsafe.Pointer
   198  func growslice(oldPtr *any, newLen, oldCap, num int, et *byte) (ary []any)
   199  func growsliceBuf(oldPtr *any, newLen, oldCap, num int, et *byte, buf *any, bufLen int) (ary []any)
   200  func growsliceBufNoAlias(oldPtr *any, newLen, oldCap, num int, et *byte, buf *any, bufLen int) (ary []any)
   201  func growsliceNoAlias(oldPtr *any, newLen, oldCap, num int, et *byte) (ary []any)
   202  func unsafeslicecheckptr(typ *byte, ptr unsafe.Pointer, len int64)
   203  func panicunsafeslicelen()
   204  func panicunsafeslicenilptr()
   205  func unsafestringcheckptr(ptr unsafe.Pointer, len int64)
   206  func panicunsafestringlen()
   207  func panicunsafestringnilptr()
   208  
   209  func moveSlice(typ *byte, old *byte, len, cap int) (*byte, int, int)
   210  func moveSliceNoScan(elemSize uintptr, old *byte, len, cap int) (*byte, int, int)
   211  func moveSliceNoCap(typ *byte, old *byte, len int) (*byte, int, int)
   212  func moveSliceNoCapNoScan(elemSize uintptr, old *byte, len int) (*byte, int, int)
   213  
   214  func memmove(to *any, frm *any, length uintptr)
   215  func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
   216  func memclrHasPointers(ptr unsafe.Pointer, n uintptr)
   217  
   218  func memequal(x, y *any, size uintptr) bool
   219  func memequal0(x, y *any) bool
   220  func memequal8(x, y *any) bool
   221  func memequal16(x, y *any) bool
   222  func memequal32(x, y *any) bool
   223  func memequal64(x, y *any) bool
   224  func memequal128(x, y *any) bool
   225  func f32equal(p, q unsafe.Pointer) bool
   226  func f64equal(p, q unsafe.Pointer) bool
   227  func c64equal(p, q unsafe.Pointer) bool
   228  func c128equal(p, q unsafe.Pointer) bool
   229  func strequal(p, q unsafe.Pointer) bool
   230  func interequal(p, q unsafe.Pointer) bool
   231  func nilinterequal(p, q unsafe.Pointer) bool
   232  
   233  func memhash(x *any, h uintptr, size uintptr) uintptr
   234  func memhash0(p unsafe.Pointer, h uintptr) uintptr
   235  func memhash8(p unsafe.Pointer, h uintptr) uintptr
   236  func memhash16(p unsafe.Pointer, h uintptr) uintptr
   237  func memhash32(p unsafe.Pointer, h uintptr) uintptr
   238  func memhash64(p unsafe.Pointer, h uintptr) uintptr
   239  func memhash128(p unsafe.Pointer, h uintptr) uintptr
   240  func f32hash(p *any, h uintptr) uintptr
   241  func f64hash(p *any, h uintptr) uintptr
   242  func c64hash(p *any, h uintptr) uintptr
   243  func c128hash(p *any, h uintptr) uintptr
   244  func strhash(a *any, h uintptr) uintptr
   245  func interhash(p *any, h uintptr) uintptr
   246  func nilinterhash(p *any, h uintptr) uintptr
   247  
   248  // only used on 32-bit
   249  func int64div(int64, int64) int64
   250  func uint64div(uint64, uint64) uint64
   251  func int64mod(int64, int64) int64
   252  func uint64mod(uint64, uint64) uint64
   253  func float64toint64(float64) int64
   254  func float64touint64(float64) uint64
   255  func float64touint32(float64) uint32
   256  func int64tofloat64(int64) float64
   257  func int64tofloat32(int64) float32
   258  func uint64tofloat64(uint64) float64
   259  func uint64tofloat32(uint64) float32
   260  func uint32tofloat64(uint32) float64
   261  
   262  func complex128div(num complex128, den complex128) (quo complex128)
   263  
   264  // race detection
   265  func racefuncenter(uintptr)
   266  func racefuncexit()
   267  func raceread(uintptr)
   268  func racewrite(uintptr)
   269  func racereadrange(addr, size uintptr)
   270  func racewriterange(addr, size uintptr)
   271  
   272  // memory sanitizer
   273  func msanread(addr, size uintptr)
   274  func msanwrite(addr, size uintptr)
   275  func msanmove(dst, src, size uintptr)
   276  
   277  // address sanitizer
   278  func asanread(addr, size uintptr)
   279  func asanwrite(addr, size uintptr)
   280  
   281  func checkptrAlignment(unsafe.Pointer, *byte, uintptr)
   282  func checkptrArithmetic(unsafe.Pointer, []unsafe.Pointer)
   283  
   284  func libfuzzerTraceCmp1(uint8, uint8, uint)
   285  func libfuzzerTraceCmp2(uint16, uint16, uint)
   286  func libfuzzerTraceCmp4(uint32, uint32, uint)
   287  func libfuzzerTraceCmp8(uint64, uint64, uint)
   288  func libfuzzerTraceConstCmp1(uint8, uint8, uint)
   289  func libfuzzerTraceConstCmp2(uint16, uint16, uint)
   290  func libfuzzerTraceConstCmp4(uint32, uint32, uint)
   291  func libfuzzerTraceConstCmp8(uint64, uint64, uint)
   292  func libfuzzerHookStrCmp(string, string, uint)
   293  func libfuzzerHookEqualFold(string, string, uint)
   294  
   295  func addCovMeta(p unsafe.Pointer, len uint32, hash [16]byte, pkpath string, pkgId int, cmode uint8, cgran uint8) uint32
   296  
   297  // architecture variants
   298  var x86HasAVX bool
   299  var x86HasFMA bool
   300  var x86HasPOPCNT bool
   301  var x86HasSSE41 bool
   302  var armHasVFPv4 bool
   303  var arm64HasATOMICS bool
   304  var loong64HasLAMCAS bool
   305  var loong64HasLAM_BH bool
   306  var loong64HasLSX bool
   307  var riscv64HasZbb bool
   308  
   309  func asanregisterglobals(unsafe.Pointer, uintptr)
   310  
   311  // used by testing.B.Loop
   312  func KeepAlive(interface{})
   313  

View as plain text