//go:linkname unsafe_New reflect.unsafe_New func unsafe_New(rtype unsafe.Pointer) unsafe.Pointer //go:linkname typedmemmove reflect.typedmemmove func typedmemmove(rtype unsafe.Pointer, dst, src unsafe.Pointer) //go:linkname unsafe_NewArray reflect.unsafe_NewArray func unsafe_NewArray(rtype unsafe.Pointer, length int) unsafe.Pointer // typedslicecopy copies a slice of elemType values from src to dst, // returning the number of elements copied. //go:linkname typedslicecopy reflect.typedslicecopy //go:noescape func typedslicecopy(elemType unsafe.Pointer, dst, src sliceHeader) int //go:linkname mapassign reflect.mapassign //go:noescape func mapassign(rtype unsafe.Pointer, m unsafe.Pointer, key unsafe.Pointer, val unsafe.Pointer) //go:linkname mapaccess reflect.mapaccess //go:noescape func mapaccess(rtype unsafe.Pointer, m unsafe.Pointer, key unsafe.Pointer) (val unsafe.Pointer) //go:noescape //go:linkname mapiternext reflect.mapiternext func mapiternext(it *hiter) //go:linkname ifaceE2I reflect.ifaceE2I func ifaceE2I(rtype unsafe.Pointer, src interface{ … } type hiter … // add returns p+x. // // The whySafe string is ignored, so that the function still inlines // as efficiently as p+x, but all call sites should use the string to // record why the addition is safe, which is to say why the addition // does not cause x to advance to the very end of p's allocation // and therefore point incorrectly at the next block in memory. func add(p unsafe.Pointer, x uintptr, whySafe string) unsafe.Pointer { … } // arrayAt returns the i-th element of p, // an array whose elements are eltSize bytes wide. // The array pointed at by p must have at least i+1 elements: // it is invalid (but impossible to check here) to pass i >= len, // because then the result will point outside the array. // whySafe must explain why i < len. (Passing "i < len" is fine; // the benefit is to surface this assumption at the call site.) func arrayAt(p unsafe.Pointer, i int, eltSize uintptr, whySafe string) unsafe.Pointer { … }