aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime2.go
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2022-09-02 10:10:54 -0400
committerMichael Pratt <mpratt@google.com>2022-09-02 19:38:45 +0000
commite4061120115d1bcdbe17f863e6559ed7b412a73d (patch)
treef63a8dac291b0ef3f447d8d65515f9923795be0f /src/runtime/runtime2.go
parentd1681120be027579f0556dfd3b07f205cab3ff6b (diff)
downloadgo-e4061120115d1bcdbe17f863e6559ed7b412a73d.tar.xz
runtime: document implicit fields at the end of _func
Currently these are only implicitly documented by the code that generates and consumes them. Add explicit documentation. Change-Id: I25a1294f04dc11785242643bec83370c66ff7a20 Reviewed-on: https://go-review.googlesource.com/c/go/+/427954 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/runtime/runtime2.go')
-rw-r--r--src/runtime/runtime2.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index 44dcfcca82..f9bdb8e236 100644
--- a/src/runtime/runtime2.go
+++ b/src/runtime/runtime2.go
@@ -873,6 +873,28 @@ type _func struct {
flag funcFlag
_ [1]byte // pad
nfuncdata uint8 // must be last, must end on a uint32-aligned boundary
+
+ // The end of the struct is followed immediately by two variable-length
+ // arrays that reference the pcdata and funcdata locations for this
+ // function.
+
+ // pcdata contains the offset into moduledata.pctab for the start of
+ // that index's table. e.g.,
+ // &moduledata.pctab[_func.pcdata[_PCDATA_UnsafePoint]] is the start of
+ // the unsafe point table.
+ //
+ // An offset of 0 indicates that there is no table.
+ //
+ // pcdata [npcdata]uint32
+
+ // funcdata contains the offset past moduledata.gofunc which contains a
+ // pointer to that index's funcdata. e.g.,
+ // *(moduledata.gofunc + _func.funcdata[_FUNCDATA_ArgsPointerMaps]) is
+ // the argument pointer map.
+ //
+ // An offset of ^uint32(0) indicates that there is no entry.
+ //
+ // funcdata [nfuncdata]uint32
}
// Pseudo-Func that is returned for PCs that occur in inlined code.