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  // 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  
    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 cmpstring(string, string) int
    75  func intstring(*[4]byte, int64) string
    76  func slicebytetostring(buf *[32]byte, ptr *byte, n int) string
    77  func slicebytetostringtmp(ptr *byte, n int) string
    78  func slicerunetostring(*[32]byte, []rune) string
    79  func stringtoslicebyte(*[32]byte, string) []byte
    80  func stringtoslicerune(*[32]rune, string) []rune
    81  func slicecopy(toPtr *any, toLen int, fromPtr *any, fromLen int, wid uintptr) int
    82  
    83  func decoderune(string, int) (retv rune, retk int)
    84  func countrunes(string) int
    85  
    86  // Non-empty-interface to non-empty-interface conversion.
    87  func convI2I(typ *byte, itab *uintptr) (ret *uintptr)
    88  
    89  // Convert non-interface type to the data word of a (empty or nonempty) interface.
    90  func convT(typ *byte, elem *any) unsafe.Pointer
    91  
    92  // Same as convT, for types with no pointers in them.
    93  func 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.
   101  func convT16(val uint16) unsafe.Pointer
   102  func convT32(val uint32) unsafe.Pointer
   103  func convT64(val uint64) unsafe.Pointer
   104  func convTstring(val string) unsafe.Pointer
   105  func convTslice(val []uint8) unsafe.Pointer
   106  
   107  // interface type assertions x.(T)
   108  func assertE2I(inter *byte, typ *byte) *byte
   109  func assertE2I2(inter *byte, eface any) (ret any)
   110  func assertI2I(inter *byte, tab *byte) *byte
   111  func assertI2I2(inter *byte, iface any) (ret any)
   112  func panicdottypeE(have, want, iface *byte)
   113  func panicdottypeI(have, want, iface *byte)
   114  func panicnildottype(want *byte)
   115  
   116  // interface equality. Type/itab pointers are already known to be equal, so
   117  // we only need to pass one.
   118  func ifaceeq(tab *uintptr, x, y unsafe.Pointer) (ret bool)
   119  func efaceeq(typ *uintptr, x, y unsafe.Pointer) (ret bool)
   120  
   121  func fastrand() uint32
   122  
   123  // *byte is really *runtime.Type
   124  func makemap64(mapType *byte, hint int64, mapbuf *any) (hmap map[any]any)
   125  func makemap(mapType *byte, hint int, mapbuf *any) (hmap map[any]any)
   126  func makemap_small() (hmap map[any]any)
   127  func mapaccess1(mapType *byte, hmap map[any]any, key *any) (val *any)
   128  func mapaccess1_fast32(mapType *byte, hmap map[any]any, key uint32) (val *any)
   129  func mapaccess1_fast64(mapType *byte, hmap map[any]any, key uint64) (val *any)
   130  func mapaccess1_faststr(mapType *byte, hmap map[any]any, key string) (val *any)
   131  func mapaccess1_fat(mapType *byte, hmap map[any]any, key *any, zero *byte) (val *any)
   132  func mapaccess2(mapType *byte, hmap map[any]any, key *any) (val *any, pres bool)
   133  func mapaccess2_fast32(mapType *byte, hmap map[any]any, key uint32) (val *any, pres bool)
   134  func mapaccess2_fast64(mapType *byte, hmap map[any]any, key uint64) (val *any, pres bool)
   135  func mapaccess2_faststr(mapType *byte, hmap map[any]any, key string) (val *any, pres bool)
   136  func mapaccess2_fat(mapType *byte, hmap map[any]any, key *any, zero *byte) (val *any, pres bool)
   137  func mapassign(mapType *byte, hmap map[any]any, key *any) (val *any)
   138  func mapassign_fast32(mapType *byte, hmap map[any]any, key uint32) (val *any)
   139  func mapassign_fast32ptr(mapType *byte, hmap map[any]any, key unsafe.Pointer) (val *any)
   140  func mapassign_fast64(mapType *byte, hmap map[any]any, key uint64) (val *any)
   141  func mapassign_fast64ptr(mapType *byte, hmap map[any]any, key unsafe.Pointer) (val *any)
   142  func mapassign_faststr(mapType *byte, hmap map[any]any, key string) (val *any)
   143  func mapiterinit(mapType *byte, hmap map[any]any, hiter *any)
   144  func mapdelete(mapType *byte, hmap map[any]any, key *any)
   145  func mapdelete_fast32(mapType *byte, hmap map[any]any, key uint32)
   146  func mapdelete_fast64(mapType *byte, hmap map[any]any, key uint64)
   147  func mapdelete_faststr(mapType *byte, hmap map[any]any, key string)
   148  func mapiternext(hiter *any)
   149  func mapclear(mapType *byte, hmap map[any]any)
   150  
   151  // *byte is really *runtime.Type
   152  func makechan64(chanType *byte, size int64) (hchan chan any)
   153  func makechan(chanType *byte, size int) (hchan chan any)
   154  func chanrecv1(hchan <-chan any, elem *any)
   155  func chanrecv2(hchan <-chan any, elem *any) bool
   156  func chansend1(hchan chan<- any, elem *any)
   157  func closechan(hchan any)
   158  
   159  var 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
   168  func typedmemmove(typ *byte, dst *any, src *any)
   169  func typedmemclr(typ *byte, dst *any)
   170  func typedslicecopy(typ *byte, dstPtr *any, dstLen int, srcPtr *any, srcLen int) int
   171  
   172  func selectnbsend(hchan chan<- any, elem *any) bool
   173  func selectnbrecv(elem *any, hchan <-chan any) (bool, bool)
   174  
   175  func selectsetpc(pc *uintptr)
   176  func selectgo(cas0 *byte, order0 *byte, pc0 *uintptr, nsends int, nrecvs int, block bool) (int, bool)
   177  func block()
   178  
   179  func makeslice(typ *byte, len int, cap int) unsafe.Pointer
   180  func makeslice64(typ *byte, len int64, cap int64) unsafe.Pointer
   181  func makeslicecopy(typ *byte, tolen int, fromlen int, from unsafe.Pointer) unsafe.Pointer
   182  func growslice(typ *byte, old []any, cap int) (ary []any)
   183  func unsafeslice(typ *byte, ptr unsafe.Pointer, len int)
   184  func unsafeslice64(typ *byte, ptr unsafe.Pointer, len int64)
   185  func unsafeslicecheckptr(typ *byte, ptr unsafe.Pointer, len int64)
   186  
   187  func memmove(to *any, frm *any, length uintptr)
   188  func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
   189  func memclrHasPointers(ptr unsafe.Pointer, n uintptr)
   190  
   191  func memequal(x, y *any, size uintptr) bool
   192  func memequal0(x, y *any) bool
   193  func memequal8(x, y *any) bool
   194  func memequal16(x, y *any) bool
   195  func memequal32(x, y *any) bool
   196  func memequal64(x, y *any) bool
   197  func memequal128(x, y *any) bool
   198  func f32equal(p, q unsafe.Pointer) bool
   199  func f64equal(p, q unsafe.Pointer) bool
   200  func c64equal(p, q unsafe.Pointer) bool
   201  func c128equal(p, q unsafe.Pointer) bool
   202  func strequal(p, q unsafe.Pointer) bool
   203  func interequal(p, q unsafe.Pointer) bool
   204  func nilinterequal(p, q unsafe.Pointer) bool
   205  
   206  func memhash(p unsafe.Pointer, h uintptr, size uintptr) uintptr
   207  func memhash0(p unsafe.Pointer, h uintptr) uintptr
   208  func memhash8(p unsafe.Pointer, h uintptr) uintptr
   209  func memhash16(p unsafe.Pointer, h uintptr) uintptr
   210  func memhash32(p unsafe.Pointer, h uintptr) uintptr
   211  func memhash64(p unsafe.Pointer, h uintptr) uintptr
   212  func memhash128(p unsafe.Pointer, h uintptr) uintptr
   213  func f32hash(p unsafe.Pointer, h uintptr) uintptr
   214  func f64hash(p unsafe.Pointer, h uintptr) uintptr
   215  func c64hash(p unsafe.Pointer, h uintptr) uintptr
   216  func c128hash(p unsafe.Pointer, h uintptr) uintptr
   217  func strhash(a unsafe.Pointer, h uintptr) uintptr
   218  func interhash(p unsafe.Pointer, h uintptr) uintptr
   219  func nilinterhash(p unsafe.Pointer, h uintptr) uintptr
   220  
   221  // only used on 32-bit
   222  func int64div(int64, int64) int64
   223  func uint64div(uint64, uint64) uint64
   224  func int64mod(int64, int64) int64
   225  func uint64mod(uint64, uint64) uint64
   226  func float64toint64(float64) int64
   227  func float64touint64(float64) uint64
   228  func float64touint32(float64) uint32
   229  func int64tofloat64(int64) float64
   230  func int64tofloat32(int64) float32
   231  func uint64tofloat64(uint64) float64
   232  func uint64tofloat32(uint64) float32
   233  func uint32tofloat64(uint32) float64
   234  
   235  func complex128div(num complex128, den complex128) (quo complex128)
   236  
   237  func getcallerpc() uintptr
   238  func getcallersp() uintptr
   239  
   240  // race detection
   241  func racefuncenter(uintptr)
   242  func racefuncexit()
   243  func raceread(uintptr)
   244  func racewrite(uintptr)
   245  func racereadrange(addr, size uintptr)
   246  func racewriterange(addr, size uintptr)
   247  
   248  // memory sanitizer
   249  func msanread(addr, size uintptr)
   250  func msanwrite(addr, size uintptr)
   251  func msanmove(dst, src, size uintptr)
   252  
   253  // address sanitizer
   254  func asanread(addr, size uintptr)
   255  func asanwrite(addr, size uintptr)
   256  
   257  func checkptrAlignment(unsafe.Pointer, *byte, uintptr)
   258  func checkptrArithmetic(unsafe.Pointer, []unsafe.Pointer)
   259  
   260  func libfuzzerTraceCmp1(uint8, uint8)
   261  func libfuzzerTraceCmp2(uint16, uint16)
   262  func libfuzzerTraceCmp4(uint32, uint32)
   263  func libfuzzerTraceCmp8(uint64, uint64)
   264  func libfuzzerTraceConstCmp1(uint8, uint8)
   265  func libfuzzerTraceConstCmp2(uint16, uint16)
   266  func libfuzzerTraceConstCmp4(uint32, uint32)
   267  func libfuzzerTraceConstCmp8(uint64, uint64)
   268  
   269  // architecture variants
   270  var x86HasPOPCNT bool
   271  var x86HasSSE41 bool
   272  var x86HasFMA bool
   273  var armHasVFPv4 bool
   274  var arm64HasATOMICS bool
   275  

View as plain text