]> Cypherpunks.ru repositories - gostls13.git/commit
runtime: replace stkframe.arglen/argmap with methods
authorAustin Clements <austin@google.com>
Sun, 14 Aug 2022 01:39:56 +0000 (21:39 -0400)
committerGopher Robot <gobot@golang.org>
Fri, 2 Sep 2022 19:08:53 +0000 (19:08 +0000)
commitdbf442b1b2c28b77db288121ee3a7bc669cdc768
tree5dd7c523f179b057da499855e3b0360fb24edaee
parent511cd9b8af10de9cad86be38a22e5eb2e5d4cd8d
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>
src/cmd/compile/internal/test/inl_test.go
src/runtime/heapdump.go
src/runtime/mgcmark.go
src/runtime/runtime2.go
src/runtime/stack.go
src/runtime/traceback.go