aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/stack.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2021-10-05 11:31:57 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2021-10-05 20:35:54 +0000
commit990c9c6cabad6a083ac67c591a38f73d00850da8 (patch)
tree5e00a6e4ca4cfa50ea1faad7e6a15d624823c90b /src/runtime/stack.go
parent113b52979f48331b611e0fe7dadff97d6393ca27 (diff)
downloadgo-990c9c6cabad6a083ac67c591a38f73d00850da8.tar.xz
Revert "runtime: use unsafe.Slice in getStackMap"
This reverts commit golang.org/cl/352953. Reason for revert: unsafe.Slice is considerably slower. Part of this is extra safety checks (good), but most of it is the function call overhead. We should consider open-coding it (#48798). Impact of this change: name old time/op new time/op delta StackCopyWithStkobj-8 12.1ms ± 5% 11.6ms ± 3% -4.03% (p=0.009 n=10+8) Change-Id: Ib2448e3edac25afd8fb55ffbea073b8b11521bde Reviewed-on: https://go-review.googlesource.com/c/go/+/354090 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/stack.go')
-rw-r--r--src/runtime/stack.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/runtime/stack.go b/src/runtime/stack.go
index efaa799022..284c6b3b84 100644
--- a/src/runtime/stack.go
+++ b/src/runtime/stack.go
@@ -1328,8 +1328,7 @@ func getStackMap(frame *stkframe, cache *pcvalueCache, debug bool) (locals, args
if p != nil {
n := *(*uintptr)(p)
p = add(p, goarch.PtrSize)
- r0 := (*stackObjectRecord)(noescape(p))
- objs = unsafe.Slice(r0, int(n))
+ *(*slice)(unsafe.Pointer(&objs)) = slice{array: noescape(p), len: int(n), cap: int(n)}
// Note: the noescape above is needed to keep
// getStackMap from "leaking param content:
// frame". That leak propagates up to getgcmask, then