diff options
| author | Austin Clements <austin@google.com> | 2021-07-23 15:03:00 -0400 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2021-07-30 18:49:41 +0000 |
| commit | ea94e5d3c57fadea088cdc5002e014b3c7ef4bc1 (patch) | |
| tree | 6bdf36c5ced4fb4ff263f20f454410f2a0cb2c40 /src/runtime/heapdump.go | |
| parent | 4480e3b11ab6dcd8d4c6a1e87388f573ff49f429 (diff) | |
| download | go-ea94e5d3c57fadea088cdc5002e014b3c7ef4bc1.tar.xz | |
[dev.typeparams] runtime: use func() for deferred functions
Prior to regabi, a deferred function could have any signature, so the
runtime always manipulated them as funcvals. Now, a deferred function
is always func(). Hence, this CL makes the runtime's manipulation of
deferred functions more type-safe by using func() directly instead of
*funcval.
Change-Id: Ib55f38ed49107f74149725c65044e4690761971d
Reviewed-on: https://go-review.googlesource.com/c/go/+/337650
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/runtime/heapdump.go')
| -rw-r--r-- | src/runtime/heapdump.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/runtime/heapdump.go b/src/runtime/heapdump.go index 18e4666fa4..8fb30d95b9 100644 --- a/src/runtime/heapdump.go +++ b/src/runtime/heapdump.go @@ -381,12 +381,13 @@ func dumpgoroutine(gp *g) { dumpint(uint64(uintptr(unsafe.Pointer(gp)))) dumpint(uint64(d.sp)) dumpint(uint64(d.pc)) - dumpint(uint64(uintptr(unsafe.Pointer(d.fn)))) + fn := *(**funcval)(unsafe.Pointer(&d.fn)) + dumpint(uint64(uintptr(unsafe.Pointer(fn)))) if d.fn == nil { // d.fn can be nil for open-coded defers dumpint(uint64(0)) } else { - dumpint(uint64(uintptr(unsafe.Pointer(d.fn.fn)))) + dumpint(uint64(uintptr(unsafe.Pointer(fn.fn)))) } dumpint(uint64(uintptr(unsafe.Pointer(d.link)))) } |
