From 4f881115d4067bda8a236aabcae8c41cdd13b4d0 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Mon, 16 Sep 2024 15:58:36 -0400 Subject: runtime: move getcallersp to internal/runtime/sys Moving these intrinsics to a base package enables other internal/runtime packages to use them. For #54766. Change-Id: I45a530422207dd94b5ad4eee51216c9410a84040 Reviewed-on: https://go-review.googlesource.com/c/go/+/613261 Reviewed-by: Cherry Mui LUCI-TryBot-Result: Go LUCI --- src/internal/runtime/sys/intrinsics.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/internal/runtime/sys') diff --git a/src/internal/runtime/sys/intrinsics.go b/src/internal/runtime/sys/intrinsics.go index 9607f805c8..8a431d0b36 100644 --- a/src/internal/runtime/sys/intrinsics.go +++ b/src/internal/runtime/sys/intrinsics.go @@ -208,26 +208,28 @@ func Prefetch(addr uintptr) {} func PrefetchStreamed(addr uintptr) {} // GetCallerPC returns the program counter (PC) of its caller's caller. -// getcallersp returns the stack pointer (SP) of its caller's caller. +// GetCallerSP returns the stack pointer (SP) of its caller's caller. // Both are implemented as intrinsics on every platform. // // For example: // // func f(arg1, arg2, arg3 int) { // pc := GetCallerPC() -// sp := getcallersp() +// sp := GetCallerSP() // } // // These two lines find the PC and SP immediately following // the call to f (where f will return). // -// The call to GetCallerPC and getcallersp must be done in the +// The call to GetCallerPC and GetCallerSP must be done in the // frame being asked about. // -// The result of getcallersp is correct at the time of the return, +// The result of GetCallerSP is correct at the time of the return, // but it may be invalidated by any subsequent call to a function // that might relocate the stack in order to grow or shrink it. -// A general rule is that the result of getcallersp should be used +// A general rule is that the result of GetCallerSP should be used // immediately and can only be passed to nosplit functions. func GetCallerPC() uintptr + +func GetCallerSP() uintptr -- cgit v1.3-5-g9baa