aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/stack.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2021-09-28 17:42:05 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2021-09-29 17:50:31 +0000
commita9d5ea650b39ed144ea32a41fb551c038fb48f0c (patch)
tree8ac2240ac9665f270e9d5937b3247076decce66a /src/runtime/stack.go
parentb8990ec932c21e503f28e95e8323dbd9a090ac28 (diff)
downloadgo-a9d5ea650b39ed144ea32a41fb551c038fb48f0c.tar.xz
runtime: use unsafe.Slice in getStackMap
It's not less code, but it is clearer code. Change-Id: I32239baf92487a56900a4edd8a2593014f37d093 Reviewed-on: https://go-review.googlesource.com/c/go/+/352953 Trust: Josh Bleecher Snyder <josharian@gmail.com> Trust: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/stack.go')
-rw-r--r--src/runtime/stack.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/runtime/stack.go b/src/runtime/stack.go
index 22fff73947..0946e6975a 100644
--- a/src/runtime/stack.go
+++ b/src/runtime/stack.go
@@ -1327,7 +1327,8 @@ func getStackMap(frame *stkframe, cache *pcvalueCache, debug bool) (locals, args
if p != nil {
n := *(*uintptr)(p)
p = add(p, goarch.PtrSize)
- *(*slice)(unsafe.Pointer(&objs)) = slice{array: noescape(p), len: int(n), cap: int(n)}
+ r0 := (*stackObjectRecord)(noescape(p))
+ objs = unsafe.Slice(r0, int(n))
// Note: the noescape above is needed to keep
// getStackMap from "leaking param content:
// frame". That leak propagates up to getgcmask, then