// typedmemmove copies a value of type typ to dst from src. // Must be nosplit, see #16026. // // TODO: Perfect for go:nosplitrec since we can't have a safe point // anywhere in the bulk barrier or memmove. // // typedmemmove should be an internal detail, // but widely used packages access it using linkname. // Notable members of the hall of shame include: // - github.com/RomiChan/protobuf // - github.com/segmentio/encoding // // Do not remove or change the type signature. // See go.dev/issue/67401. // //go:linkname typedmemmove //go:nosplit func typedmemmove(typ *abi.Type, dst, src unsafe.Pointer) { … } // wbZero performs the write barrier operations necessary before // zeroing a region of memory at address dst of type typ. // Does not actually do the zeroing. // //go:nowritebarrierrec //go:nosplit func wbZero(typ *_type, dst unsafe.Pointer) { … } // wbMove performs the write barrier operations necessary before // copying a region of memory from src to dst of type typ. // Does not actually do the copying. // //go:nowritebarrierrec //go:nosplit func wbMove(typ *_type, dst, src unsafe.Pointer) { … } // reflect_typedmemmove is meant for package reflect, // but widely used packages access it using linkname. // Notable members of the hall of shame include: // - gitee.com/quant1x/gox // - github.com/goccy/json // - github.com/modern-go/reflect2 // - github.com/ugorji/go/codec // - github.com/v2pro/plz // // Do not remove or change the type signature. // See go.dev/issue/67401. // //go:linkname reflect_typedmemmove reflect.typedmemmove func reflect_typedmemmove(typ *_type, dst, src unsafe.Pointer) { … } //go:linkname reflectlite_typedmemmove internal/reflectlite.typedmemmove func reflectlite_typedmemmove(typ *_type, dst, src unsafe.Pointer) { … } //go:linkname maps_typedmemmove internal/runtime/maps.typedmemmove func maps_typedmemmove(typ *_type, dst, src unsafe.Pointer) { … } // reflectcallmove is invoked by reflectcall to copy the return values // out of the stack and into the heap, invoking the necessary write // barriers. dst, src, and size describe the return value area to // copy. typ describes the entire frame (not just the return values). // typ may be nil, which indicates write barriers are not needed. // // It must be nosplit and must only call nosplit functions because the // stack map of reflectcall is wrong. // //go:nosplit func reflectcallmove(typ *_type, dst, src unsafe.Pointer, size uintptr, regs *abi.RegArgs) { … } // typedslicecopy should be an internal detail, // but widely used packages access it using linkname. // Notable members of the hall of shame include: // - github.com/segmentio/encoding // // Do not remove or change the type signature. // See go.dev/issue/67401. // //go:linkname typedslicecopy //go:nosplit func typedslicecopy(typ *_type, dstPtr unsafe.Pointer, dstLen int, srcPtr unsafe.Pointer, srcLen int) int { … } // reflect_typedslicecopy is meant for package reflect, // but widely used packages access it using linkname. // Notable members of the hall of shame include: // - gitee.com/quant1x/gox // - github.com/modern-go/reflect2 // - github.com/RomiChan/protobuf // - github.com/segmentio/encoding // - github.com/v2pro/plz // // Do not remove or change the type signature. // See go.dev/issue/67401. // //go:linkname reflect_typedslicecopy reflect.typedslicecopy func reflect_typedslicecopy(elemType *_type, dst, src slice) int { … } // typedmemclr clears the typed memory at ptr with type typ. The // memory at ptr must already be initialized (and hence in type-safe // state). If the memory is being initialized for the first time, see // memclrNoHeapPointers. // // If the caller knows that typ has pointers, it can alternatively // call memclrHasPointers. // // TODO: A "go:nosplitrec" annotation would be perfect for this. // //go:nosplit func typedmemclr(typ *_type, ptr unsafe.Pointer) { … } // reflect_typedslicecopy is meant for package reflect, // but widely used packages access it using linkname. // Notable members of the hall of shame include: // - github.com/ugorji/go/codec // // Do not remove or change the type signature. // See go.dev/issue/67401. // //go:linkname reflect_typedmemclr reflect.typedmemclr func reflect_typedmemclr(typ *_type, ptr unsafe.Pointer) { … } //go:linkname maps_typedmemclr internal/runtime/maps.typedmemclr func maps_typedmemclr(typ *_type, ptr unsafe.Pointer) { … } //go:linkname reflect_typedmemclrpartial reflect.typedmemclrpartial func reflect_typedmemclrpartial(typ *_type, ptr unsafe.Pointer, off, size uintptr) { … } //go:linkname reflect_typedarrayclear reflect.typedarrayclear func reflect_typedarrayclear(typ *_type, ptr unsafe.Pointer, len int) { … } // memclrHasPointers clears n bytes of typed memory starting at ptr. // The caller must ensure that the type of the object at ptr has // pointers, usually by checking typ.PtrBytes. However, ptr // does not have to point to the start of the allocation. // // memclrHasPointers should be an internal detail, // but widely used packages access it using linkname. // Notable members of the hall of shame include: // - github.com/bytedance/sonic // // Do not remove or change the type signature. // See go.dev/issue/67401. // //go:linkname memclrHasPointers //go:nosplit func memclrHasPointers(ptr unsafe.Pointer, n uintptr) { … }