diff options
| author | Austin Clements <austin@google.com> | 2022-08-13 21:39:56 -0400 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2022-09-02 19:08:53 +0000 |
| commit | dbf442b1b2c28b77db288121ee3a7bc669cdc768 (patch) | |
| tree | 5dd7c523f179b057da499855e3b0360fb24edaee /src/runtime/runtime2.go | |
| parent | 511cd9b8af10de9cad86be38a22e5eb2e5d4cd8d (diff) | |
| download | go-dbf442b1b2c28b77db288121ee3a7bc669cdc768.tar.xz | |
runtime: replace stkframe.arglen/argmap with methods
Currently, stkframe.arglen and stkframe.argmap are populated by
gentraceback under a particular set of circumstances. But because they
can be constructed from other fields in stkframe, they don't need to
be computed eagerly at all. They're also rather misleading, as they're
only part of computing the actual argument map and most callers should
be using getStackMap, which does the rest of the work.
This CL drops these fields from stkframe. It shifts the functions that
used to compute them, getArgInfoFast and getArgInfo, into
corresponding methods stkframe.argBytes and stkframe.argMapInternal.
argBytes is expected to be used by callers that need to know only the
argument frame size, while argMapInternal is used only by argBytes and
getStackMap.
We also move some of the logic from getStackMap into argMapInternal
because the previous split of responsibilities didn't make much sense.
This lets us return just a bitvector from argMapInternal, rather than
both a bitvector, which carries a size, and an "actually use this
size".
The getArgInfoFast function was inlined before (and inl_test checked
this). We drop that requirement from stkframe.argBytes because the
uses of this have shifted and now it's only called from heap dumping
(which never happens) and conservative stack frame scanning (which
very, very rarely happens).
There will be a few follow-up clean-up CLs.
For #54466. This is a nice clean-up on its own, but it also serves to
remove pointers from the traceback state that would eventually become
troublesome write barriers once we stack-rip gentraceback.
Change-Id: I107f98ed8e7b00185c081de425bbf24af02a4163
Reviewed-on: https://go-review.googlesource.com/c/go/+/424514
Run-TryBot: Austin Clements <austin@google.com>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/runtime/runtime2.go')
| -rw-r--r-- | src/runtime/runtime2.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 4e67fd6e44..fe9b770b44 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -1027,13 +1027,11 @@ type stkframe struct { // This is the PC to use to look up GC liveness for this frame. continpc uintptr - lr uintptr // program counter at caller aka link register - sp uintptr // stack pointer at pc - fp uintptr // stack pointer at caller aka frame pointer - varp uintptr // top of local variables - argp uintptr // pointer to function arguments - arglen uintptr // number of bytes at argp - argmap *bitvector // force use of this argmap + lr uintptr // program counter at caller aka link register + sp uintptr // stack pointer at pc + fp uintptr // stack pointer at caller aka frame pointer + varp uintptr // top of local variables + argp uintptr // pointer to function arguments } // ancestorInfo records details of where a goroutine was started. |
