aboutsummaryrefslogtreecommitdiff
path: root/src/internal/runtime/sys
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2024-09-16 15:58:36 -0400
committerMichael Pratt <mpratt@google.com>2024-09-17 17:01:20 +0000
commit4f881115d4067bda8a236aabcae8c41cdd13b4d0 (patch)
tree2249bfaec1950819e5e22184e61e60dcd076ae40 /src/internal/runtime/sys
parent41ca2637d4df8b8edf63436c6caab56821d2af38 (diff)
downloadgo-4f881115d4067bda8a236aabcae8c41cdd13b4d0.tar.xz
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 <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/internal/runtime/sys')
-rw-r--r--src/internal/runtime/sys/intrinsics.go12
1 files changed, 7 insertions, 5 deletions
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