runtime: make internal CallersFrames-equivalent that doesn't escape PC slice
The Frames API forces the PC slice to escape to the heap because it stores it in the Frames object. However, we'd like to use this API for call stack expansion internally in the runtime in places where it would be very good to avoid heap allocation. This commit makes this possible by pulling the bulk of the Frames implementation into an internal frameExpander API. The key difference between these APIs is that the frameExpander does not hold the PC slice; instead, the caller is responsible for threading the PC slice through the frameExpander API calls. This makes it possible to keep the PC slice on the stack. The Frames API then becomes a thin shim around the frameExpander that keeps the PC slice in the Frames object. Change-Id: If6b2d0b9132a2a905a0cf5deced9feddce76fc0e Reviewed-on: https://go-review.googlesource.com/40610 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Lazar <lazard@golang.org>
Showing
Please register or sign in to comment