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

View as plain text