compiler: really define runtime.mem* as LLVM intrinsic wrappers

This makes it possible to //go:linkname them from other places, like in
the reflect package. And is in my opinion a much cleaner solution.
This commit is contained in:
Ayke van Laethem
2022-06-20 15:19:57 +02:00
committed by Ron Evans
parent 1ceb63d14c
commit 4262f0ff1f
4 changed files with 23 additions and 22 deletions
+1 -2
View File
@@ -808,8 +808,7 @@ func (e *ValueError) Error() string {
return "reflect: call of " + e.Method + " on " + e.Kind.String() + " Value"
}
// Calls to this function are converted to LLVM intrinsic calls such as
// llvm.memcpy.p0i8.p0i8.i32().
//go:linkname memcpy runtime.memcpy
func memcpy(dst, src unsafe.Pointer, size uintptr)
//go:linkname alloc runtime.alloc
+6 -6
View File
@@ -26,19 +26,19 @@ func GOROOT() string {
}
// Copy size bytes from src to dst. The memory areas must not overlap.
// Calls to this function are converted to LLVM intrinsic calls such as
// llvm.memcpy.p0i8.p0i8.i32(dst, src, size, false).
// This function is implemented by the compiler as a call to a LLVM intrinsic
// like llvm.memcpy.p0i8.p0i8.i32(dst, src, size, false).
func memcpy(dst, src unsafe.Pointer, size uintptr)
// Copy size bytes from src to dst. The memory areas may overlap and will do the
// correct thing.
// Calls to this function are converted to LLVM intrinsic calls such as
// llvm.memmove.p0i8.p0i8.i32(dst, src, size, false).
// This function is implemented by the compiler as a call to a LLVM intrinsic
// like llvm.memmove.p0i8.p0i8.i32(dst, src, size, false).
func memmove(dst, src unsafe.Pointer, size uintptr)
// Set the given number of bytes to zero.
// Calls to this function are converted to LLVM intrinsic calls such as
// llvm.memset.p0i8.i32(ptr, 0, size, false).
// This function is implemented by the compiler as a call to a LLVM intrinsic
// like llvm.memset.p0i8.i32(ptr, 0, size, false).
func memzero(ptr unsafe.Pointer, size uintptr)
// This intrinsic returns the current stack pointer.