From: Michael Pratt Date: Fri, 2 Sep 2022 14:10:54 +0000 (-0400) Subject: runtime: document implicit fields at the end of _func X-Git-Tag: go1.20rc1~1236 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e4061120115d1bcdbe17f863e6559ed7b412a73d;p=gostls13.git 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 Reviewed-by: Cherry Mui Run-TryBot: Michael Pratt --- 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.