Skip to content

Commit

Permalink
runtime: avoid large object stack copy in traceStackTable.dump
Browse files Browse the repository at this point in the history
Following up on the previous CL, this CL removes a unnecessary stack
copy of a large object in a range loop. This drops another 64 KiB from
(*traceStackTable).dump's stack frame so it is now roughly 80 bytes
depending on architecture, which will easily fit on the system stack.

For #53979.

Change-Id: I16f642f6f1982d0ed0a62371bf2e19379e5870eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/422955
Reviewed-by: Michael Knyszek <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Run-TryBot: Austin Clements <[email protected]>
  • Loading branch information
aclements committed Aug 11, 2022
1 parent d4a3466 commit 0293a1f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/runtime/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -1060,8 +1060,8 @@ func traceFrames(bufp traceBufPtr, pcs []uintptr) ([]traceFrame, traceBufPtr) {
// releases all memory and resets state.
func (tab *traceStackTable) dump() {
bufp := traceFlush(0, 0)
for _, stk := range tab.tab {
stk := stk.ptr()
for i, _ := range tab.tab {
stk := tab.tab[i].ptr()
for ; stk != nil; stk = stk.link.ptr() {
var frames []traceFrame
frames, bufp = traceFrames(bufp, stk.stack())
Expand Down

0 comments on commit 0293a1f

Please sign in to comment.