aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/stack.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2025-10-07 07:58:50 -0700
committerGopher Robot <gobot@golang.org>2025-10-07 08:21:14 -0700
commitc938051dd0b80a5c60572d6807270d06ca685d2e (patch)
treec4e69ab40d336c192c7cb7ec0a5f50ed54f97d80 /src/runtime/stack.go
parent64699542031b994ec4fdb6de887a94b69a372f9b (diff)
downloadgo-c938051dd0b80a5c60572d6807270d06ca685d2e.tar.xz
Revert "cmd/compile: redo arm64 LR/FP save and restore"
This reverts commit 719dfcf8a8478d70360bf3c34c0e920be7b32994. Reason for revert: Causing crashes. Change-Id: I0b8526dd03d82fa074ce4f97f1789eeac702b3eb Reviewed-on: https://go-review.googlesource.com/c/go/+/709755 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/runtime/stack.go')
-rw-r--r--src/runtime/stack.go20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/runtime/stack.go b/src/runtime/stack.go
index 5eaceec6da..55e97e77af 100644
--- a/src/runtime/stack.go
+++ b/src/runtime/stack.go
@@ -579,27 +579,23 @@ var ptrnames = []string{
// | args to callee |
// +------------------+ <- frame->sp
//
-// (arm64)
+// (arm)
// +------------------+
// | args from caller |
// +------------------+ <- frame->argp
-// | <unused> |
-// +------------------+ <- frame->fp (aka caller's sp)
-// | return address |
+// | caller's retaddr |
// +------------------+
-// | caller's FP | (frame pointer always enabled: TODO)
+// | caller's FP (*) | (*) on ARM64, if framepointer_enabled && varp > sp
// +------------------+ <- frame->varp
// | locals |
// +------------------+
// | args to callee |
// +------------------+
-// | <unused> |
+// | return address |
// +------------------+ <- frame->sp
//
// varp > sp means that the function has a frame;
// varp == sp means frameless function.
-//
-// Alignment padding, if needed, will be between "locals" and "args to callee".
type adjustinfo struct {
old stack
@@ -713,8 +709,7 @@ func adjustframe(frame *stkframe, adjinfo *adjustinfo) {
}
// Adjust saved frame pointer if there is one.
- if goarch.ArchFamily == goarch.AMD64 && frame.argp-frame.varp == 2*goarch.PtrSize ||
- goarch.ArchFamily == goarch.ARM64 && frame.argp-frame.varp == 3*goarch.PtrSize {
+ if (goarch.ArchFamily == goarch.AMD64 || goarch.ArchFamily == goarch.ARM64) && frame.argp-frame.varp == 2*goarch.PtrSize {
if stackDebug >= 3 {
print(" saved bp\n")
}
@@ -728,7 +723,10 @@ func adjustframe(frame *stkframe, adjinfo *adjustinfo) {
throw("bad frame pointer")
}
}
- // This is the caller's frame pointer saved in the current frame.
+ // On AMD64, this is the caller's frame pointer saved in the current
+ // frame.
+ // On ARM64, this is the frame pointer of the caller's caller saved
+ // by the caller in its frame (one word below its SP).
adjustpointer(adjinfo, unsafe.Pointer(frame.varp))
}