...

Source file src/pkg/cmd/compile/internal/gc/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	// +build ignore
    10	
    11	package runtime
    12	
    13	// emitted by compiler, not referred to by go programs
    14	
    15	import "unsafe"
    16	
    17	func newobject(typ *byte) *any
    18	func panicdivide()
    19	func panicshift()
    20	func panicmakeslicelen()
    21	func throwinit()
    22	func panicwrap()
    23	
    24	func gopanic(interface{})
    25	func gorecover(*int32) interface{}
    26	func goschedguarded()
    27	
    28	// Note: these declarations are just for wasm port.
    29	// Other ports call assembly stubs instead.
    30	func goPanicIndex(x int, y int)
    31	func goPanicIndexU(x uint, y int)
    32	func goPanicSliceAlen(x int, y int)
    33	func goPanicSliceAlenU(x uint, y int)
    34	func goPanicSliceAcap(x int, y int)
    35	func goPanicSliceAcapU(x uint, y int)
    36	func goPanicSliceB(x int, y int)
    37	func goPanicSliceBU(x uint, y int)
    38	func goPanicSlice3Alen(x int, y int)
    39	func goPanicSlice3AlenU(x uint, y int)
    40	func goPanicSlice3Acap(x int, y int)
    41	func goPanicSlice3AcapU(x uint, y int)
    42	func goPanicSlice3B(x int, y int)
    43	func goPanicSlice3BU(x uint, y int)
    44	func goPanicSlice3C(x int, y int)
    45	func goPanicSlice3CU(x uint, y int)
    46	
    47	func printbool(bool)
    48	func printfloat(float64)
    49	func printint(int64)
    50	func printhex(uint64)
    51	func printuint(uint64)
    52	func printcomplex(complex128)
    53	func printstring(string)
    54	func printpointer(any)
    55	func printiface(any)
    56	func printeface(any)
    57	func printslice(any)
    58	func printnl()
    59	func printsp()
    60	func printlock()
    61	func printunlock()
    62	
    63	func concatstring2(*[32]byte, string, string) string
    64	func concatstring3(*[32]byte, string, string, string) string
    65	func concatstring4(*[32]byte, string, string, string, string) string
    66	func concatstring5(*[32]byte, string, string, string, string, string) string
    67	func concatstrings(*[32]byte, []string) string
    68	
    69	func cmpstring(string, string) int
    70	func intstring(*[4]byte, int64) string
    71	func slicebytetostring(*[32]byte, []byte) string
    72	func slicebytetostringtmp([]byte) string
    73	func slicerunetostring(*[32]byte, []rune) string
    74	func stringtoslicebyte(*[32]byte, string) []byte
    75	func stringtoslicerune(*[32]rune, string) []rune
    76	func slicecopy(to any, fr any, wid uintptr) int
    77	func slicestringcopy(to any, fr any) int
    78	
    79	func decoderune(string, int) (retv rune, retk int)
    80	func countrunes(string) int
    81	
    82	// Non-empty-interface to non-empty-interface conversion.
    83	func convI2I(typ *byte, elem any) (ret any)
    84	
    85	// Specialized type-to-interface conversion.
    86	// These return only a data pointer.
    87	func convT16(val any) unsafe.Pointer     // val must be uint16-like (same size and alignment as a uint16)
    88	func convT32(val any) unsafe.Pointer     // val must be uint32-like (same size and alignment as a uint32)
    89	func convT64(val any) unsafe.Pointer     // val must be uint64-like (same size and alignment as a uint64 and contains no pointers)
    90	func convTstring(val any) unsafe.Pointer // val must be a string
    91	func convTslice(val any) unsafe.Pointer  // val must be a slice
    92	
    93	// Type to empty-interface conversion.
    94	func convT2E(typ *byte, elem *any) (ret any)
    95	func convT2Enoptr(typ *byte, elem *any) (ret any)
    96	
    97	// Type to non-empty-interface conversion.
    98	func convT2I(tab *byte, elem *any) (ret any)
    99	func convT2Inoptr(tab *byte, elem *any) (ret any)
   100	
   101	// interface type assertions x.(T)
   102	func assertE2I(typ *byte, iface any) (ret any)
   103	func assertE2I2(typ *byte, iface any) (ret any, b bool)
   104	func assertI2I(typ *byte, iface any) (ret any)
   105	func assertI2I2(typ *byte, iface any) (ret any, b bool)
   106	func panicdottypeE(have, want, iface *byte)
   107	func panicdottypeI(have, want, iface *byte)
   108	func panicnildottype(want *byte)
   109	
   110	// interface equality. Type/itab pointers are already known to be equal, so
   111	// we only need to pass one.
   112	func ifaceeq(tab *uintptr, x, y unsafe.Pointer) (ret bool)
   113	func efaceeq(typ *uintptr, x, y unsafe.Pointer) (ret bool)
   114	
   115	func fastrand() uint32
   116	
   117	// *byte is really *runtime.Type
   118	func makemap64(mapType *byte, hint int64, mapbuf *any) (hmap map[any]any)
   119	func makemap(mapType *byte, hint int, mapbuf *any) (hmap map[any]any)
   120	func makemap_small() (hmap map[any]any)
   121	func mapaccess1(mapType *byte, hmap map[any]any, key *any) (val *any)
   122	func mapaccess1_fast32(mapType *byte, hmap map[any]any, key any) (val *any)
   123	func mapaccess1_fast64(mapType *byte, hmap map[any]any, key any) (val *any)
   124	func mapaccess1_faststr(mapType *byte, hmap map[any]any, key any) (val *any)
   125	func mapaccess1_fat(mapType *byte, hmap map[any]any, key *any, zero *byte) (val *any)
   126	func mapaccess2(mapType *byte, hmap map[any]any, key *any) (val *any, pres bool)
   127	func mapaccess2_fast32(mapType *byte, hmap map[any]any, key any) (val *any, pres bool)
   128	func mapaccess2_fast64(mapType *byte, hmap map[any]any, key any) (val *any, pres bool)
   129	func mapaccess2_faststr(mapType *byte, hmap map[any]any, key any) (val *any, pres bool)
   130	func mapaccess2_fat(mapType *byte, hmap map[any]any, key *any, zero *byte) (val *any, pres bool)
   131	func mapassign(mapType *byte, hmap map[any]any, key *any) (val *any)
   132	func mapassign_fast32(mapType *byte, hmap map[any]any, key any) (val *any)
   133	func mapassign_fast32ptr(mapType *byte, hmap map[any]any, key any) (val *any)
   134	func mapassign_fast64(mapType *byte, hmap map[any]any, key any) (val *any)
   135	func mapassign_fast64ptr(mapType *byte, hmap map[any]any, key any) (val *any)
   136	func mapassign_faststr(mapType *byte, hmap map[any]any, key any) (val *any)
   137	func mapiterinit(mapType *byte, hmap map[any]any, hiter *any)
   138	func mapdelete(mapType *byte, hmap map[any]any, key *any)
   139	func mapdelete_fast32(mapType *byte, hmap map[any]any, key any)
   140	func mapdelete_fast64(mapType *byte, hmap map[any]any, key any)
   141	func mapdelete_faststr(mapType *byte, hmap map[any]any, key any)
   142	func mapiternext(hiter *any)
   143	func mapclear(mapType *byte, hmap map[any]any)
   144	
   145	// *byte is really *runtime.Type
   146	func makechan64(chanType *byte, size int64) (hchan chan any)
   147	func makechan(chanType *byte, size int) (hchan chan any)
   148	func chanrecv1(hchan <-chan any, elem *any)
   149	func chanrecv2(hchan <-chan any, elem *any) bool
   150	func chansend1(hchan chan<- any, elem *any)
   151	func closechan(hchan any)
   152	
   153	var writeBarrier struct {
   154		enabled bool
   155		pad     [3]byte
   156		needed  bool
   157		cgo     bool
   158		alignme uint64
   159	}
   160	
   161	// *byte is really *runtime.Type
   162	func typedmemmove(typ *byte, dst *any, src *any)
   163	func typedmemclr(typ *byte, dst *any)
   164	func typedslicecopy(typ *byte, dst any, src any) int
   165	
   166	func selectnbsend(hchan chan<- any, elem *any) bool
   167	func selectnbrecv(elem *any, hchan <-chan any) bool
   168	func selectnbrecv2(elem *any, received *bool, hchan <-chan any) bool
   169	
   170	func selectsetpc(cas *byte)
   171	func selectgo(cas0 *byte, order0 *byte, ncases int) (int, bool)
   172	func block()
   173	
   174	func makeslice(typ *byte, len int, cap int) unsafe.Pointer
   175	func makeslice64(typ *byte, len int64, cap int64) unsafe.Pointer
   176	func growslice(typ *byte, old []any, cap int) (ary []any)
   177	func memmove(to *any, frm *any, length uintptr)
   178	func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
   179	func memclrHasPointers(ptr unsafe.Pointer, n uintptr)
   180	
   181	func memequal(x, y *any, size uintptr) bool
   182	func memequal8(x, y *any) bool
   183	func memequal16(x, y *any) bool
   184	func memequal32(x, y *any) bool
   185	func memequal64(x, y *any) bool
   186	func memequal128(x, y *any) bool
   187	
   188	// only used on 32-bit
   189	func int64div(int64, int64) int64
   190	func uint64div(uint64, uint64) uint64
   191	func int64mod(int64, int64) int64
   192	func uint64mod(uint64, uint64) uint64
   193	func float64toint64(float64) int64
   194	func float64touint64(float64) uint64
   195	func float64touint32(float64) uint32
   196	func int64tofloat64(int64) float64
   197	func uint64tofloat64(uint64) float64
   198	func uint32tofloat64(uint32) float64
   199	
   200	func complex128div(num complex128, den complex128) (quo complex128)
   201	
   202	// race detection
   203	func racefuncenter(uintptr)
   204	func racefuncenterfp()
   205	func racefuncexit()
   206	func raceread(uintptr)
   207	func racewrite(uintptr)
   208	func racereadrange(addr, size uintptr)
   209	func racewriterange(addr, size uintptr)
   210	
   211	// memory sanitizer
   212	func msanread(addr, size uintptr)
   213	func msanwrite(addr, size uintptr)
   214	
   215	// architecture variants
   216	var x86HasPOPCNT bool
   217	var x86HasSSE41 bool
   218	var arm64HasATOMICS bool
   219	

View as plain text