]> Cypherpunks repositories - gostls13.git/commit
runtime: expand inlining iteratively in CallersFrames
authorAustin Clements <austin@google.com>
Wed, 12 Apr 2017 13:43:28 +0000 (09:43 -0400)
committerAustin Clements <austin@google.com>
Wed, 12 Apr 2017 19:39:37 +0000 (19:39 +0000)
commit7f32d41e5dc3885f440244e0e181832879426b45
tree639d3df5b25954453a8ee8aa7b905af14ea2d712
parent746441f97f9d96c5c0b72dc514f1eee777303060
runtime: expand inlining iteratively in CallersFrames

Currently CallersFrames expands each PC to a slice of Frames and then
iteratively returns those Frames. However, this makes it very
difficult to avoid heap allocation: either the Frames slice will be
heap allocated, or, if it uses internal scratch space for small slices
(as it currently does), the Frames object itself has to be heap
allocated.

Fix this, at least in the common case, by expanding each PC
iteratively. We introduce a new pcExpander type that's responsible for
expanding a single PC. This maintains state from one Frame to the next
in the same PC. Frames then becomes a wrapper around this responsible
for feeding it the next PC when the pcExpander runs out of frames for
the current PC.

This makes it possible to stack-allocate a Frames object, which will
make it possible to use this API for PC expansion from within the
runtime itself.

Change-Id: I993463945ab574557cf1d6bedbe79ce7e9cbbdcd
Reviewed-on: https://go-review.googlesource.com/40434
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Lazar <lazard@golang.org>
src/runtime/symtab.go