const cgoWriteBarrierFail … // cgoCheckPtrWrite is called whenever a pointer is stored into memory. // It throws if the program is storing an unpinned Go pointer into non-Go // memory. // // This is called from generated code when GOEXPERIMENT=cgocheck2 is enabled. // //go:nosplit //go:nowritebarrier func cgoCheckPtrWrite(dst *unsafe.Pointer, src unsafe.Pointer) { … } // cgoCheckMemmove is called when moving a block of memory. // It throws if the program is copying a block that contains an unpinned Go // pointer into non-Go memory. // // This is called from generated code when GOEXPERIMENT=cgocheck2 is enabled. // //go:nosplit //go:nowritebarrier func cgoCheckMemmove(typ *_type, dst, src unsafe.Pointer) { … } // cgoCheckMemmove2 is called when moving a block of memory. // dst and src point off bytes into the value to copy. // size is the number of bytes to copy. // It throws if the program is copying a block that contains an unpinned Go // pointer into non-Go memory. // //go:nosplit //go:nowritebarrier func cgoCheckMemmove2(typ *_type, dst, src unsafe.Pointer, off, size uintptr) { … } // cgoCheckSliceCopy is called when copying n elements of a slice. // src and dst are pointers to the first element of the slice. // typ is the element type of the slice. // It throws if the program is copying slice elements that contain unpinned Go // pointers into non-Go memory. // //go:nosplit //go:nowritebarrier func cgoCheckSliceCopy(typ *_type, dst, src unsafe.Pointer, n int) { … } // cgoCheckTypedBlock checks the block of memory at src, for up to size bytes, // and throws if it finds an unpinned Go pointer. The type of the memory is typ, // and src is off bytes into that type. // //go:nosplit //go:nowritebarrier func cgoCheckTypedBlock(typ *_type, src unsafe.Pointer, off, size uintptr) { … } // cgoCheckBits checks the block of memory at src, for up to size // bytes, and throws if it finds an unpinned Go pointer. The gcbits mark each // pointer value. The src pointer is off bytes into the gcbits. // //go:nosplit //go:nowritebarrier func cgoCheckBits(src unsafe.Pointer, gcbits *byte, off, size uintptr) { … } // cgoCheckUsingType is like cgoCheckTypedBlock, but is a last ditch // fall back to look for pointers in src using the type information. // We only use this when looking at a value on the stack when the type // uses a GC program, because otherwise it's more efficient to use the // GC bits. This is called on the system stack. // //go:nowritebarrier //go:systemstack func cgoCheckUsingType(typ *_type, src unsafe.Pointer, off, size uintptr) { … }