aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/heapdump.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2023-02-13 16:20:54 -0500
committerAustin Clements <austin@google.com>2023-03-10 17:59:32 +0000
commit2d99109cfcaef22b6872dc2e07e4582586c032a2 (patch)
tree958a2c7da4df9d94953e7c2f09aaff9e4c788129 /src/runtime/heapdump.go
parentda384766a053d851d912f04afaa1113b627a0822 (diff)
downloadgo-2d99109cfcaef22b6872dc2e07e4582586c032a2.tar.xz
runtime: replace all callback uses of gentraceback with unwinder
This is a really nice simplification for all of these call sites. It also achieves a nice performance improvement for stack copying: goos: linux goarch: amd64 pkg: runtime cpu: Intel(R) Xeon(R) CPU E5-2690 v3 @ 2.60GHz │ before │ after │ │ sec/op │ sec/op vs base │ StackCopyPtr-48 89.25m ± 1% 79.78m ± 1% -10.62% (p=0.000 n=20) StackCopy-48 83.48m ± 2% 71.88m ± 1% -13.90% (p=0.000 n=20) StackCopyNoCache-48 2.504m ± 2% 2.195m ± 1% -12.32% (p=0.000 n=20) StackCopyWithStkobj-48 21.66m ± 1% 21.02m ± 2% -2.95% (p=0.000 n=20) geomean 25.21m 22.68m -10.04% Updates #54466. Change-Id: I31715b7b6efd65726940041d3052bb1c0a1186f3 Reviewed-on: https://go-review.googlesource.com/c/go/+/468297 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/runtime/heapdump.go')
-rw-r--r--src/runtime/heapdump.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/runtime/heapdump.go b/src/runtime/heapdump.go
index f57a1a1e17..59e28ae9aa 100644
--- a/src/runtime/heapdump.go
+++ b/src/runtime/heapdump.go
@@ -249,8 +249,7 @@ func dumpbv(cbv *bitvector, offset uintptr) {
}
}
-func dumpframe(s *stkframe, arg unsafe.Pointer) bool {
- child := (*childInfo)(arg)
+func dumpframe(s *stkframe, child *childInfo) {
f := s.fn
// Figure out what we can about our stack map
@@ -333,7 +332,7 @@ func dumpframe(s *stkframe, arg unsafe.Pointer) bool {
} else {
child.args.n = -1
}
- return true
+ return
}
func dumpgoroutine(gp *g) {
@@ -369,7 +368,10 @@ func dumpgoroutine(gp *g) {
child.arglen = 0
child.sp = nil
child.depth = 0
- gentraceback(pc, sp, lr, gp, 0, nil, 0x7fffffff, dumpframe, noescape(unsafe.Pointer(&child)), 0)
+ var u unwinder
+ for u.initAt(pc, sp, lr, gp, 0); u.valid(); u.next() {
+ dumpframe(&u.frame, &child)
+ }
// dump defer & panic records
for d := gp._defer; d != nil; d = d.link {