diff options
| author | Josh Bleecher Snyder <josharian@gmail.com> | 2021-09-28 17:42:05 -0700 |
|---|---|---|
| committer | Josh Bleecher Snyder <josharian@gmail.com> | 2021-09-29 17:50:31 +0000 |
| commit | a9d5ea650b39ed144ea32a41fb551c038fb48f0c (patch) | |
| tree | 8ac2240ac9665f270e9d5937b3247076decce66a /src/runtime/stack.go | |
| parent | b8990ec932c21e503f28e95e8323dbd9a090ac28 (diff) | |
| download | go-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.go | 3 |
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 |
