]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: document implicit fields at the end of _func
authorMichael Pratt <mpratt@google.com>
Fri, 2 Sep 2022 14:10:54 +0000 (10:10 -0400)
committerMichael Pratt <mpratt@google.com>
Fri, 2 Sep 2022 19:38:45 +0000 (19:38 +0000)
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>

src/runtime/runtime2.go

index 44dcfcca828d942bc70181821ce315c8c3edea09..f9bdb8e23676b0d194b52fa0837462ab97e94579 100644 (file)
@@ -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.