aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/stack.go
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2022-05-08 23:26:28 +0700
committerCuong Manh Le <cuong.manhle.vn@gmail.com>2022-05-11 04:25:28 +0000
commit4388faf9646bd4df0b0c3a5b781281d5b7948ce4 (patch)
treeef467f2be5aacf2738d1048a246d3d44674941f9 /src/runtime/stack.go
parent579902d0b1c45e85168196ed0ddfd4cfebb025f4 (diff)
downloadgo-4388faf9646bd4df0b0c3a5b781281d5b7948ce4.tar.xz
runtime: use unsafe.Slice in getStackMap
CL 362934 added open code for unsafe.Slice, so using it now no longer negatively impacts the performance. Updates #48798 Change-Id: Ifbabe8bc1cc4349c5bcd11586a11fc99bcb388b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/404974 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gopher Robot <gobot@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 b7df231722..3a22dcd552 100644
--- a/src/runtime/stack.go
+++ b/src/runtime/stack.go
@@ -1346,7 +1346,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