aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/noder/doc.go
AgeCommit message (Collapse)Author
2025-09-23cmd/compile: fix typo in commentmohanson
Fix typo for omitted. Change-Id: Ia633abe7f3d28f15f1f538425cdce9e6d9ef48c0 Reviewed-on: https://go-review.googlesource.com/c/go/+/705735 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org>
2025-06-02cmd/compile/internal/noder: document quirk of string elementsMark Freeman
Change-Id: Ifc3bf896aaaf7c6ce06a01e3dd43780d203638cf Reviewed-on: https://go-review.googlesource.com/c/go/+/677755 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Mark Freeman <mark@golang.org> Reviewed-by: Robert Griesemer <gri@google.com>
2025-06-02cmd/compile/internal/noder: stub type section and adjust othersMark Freeman
The type definition and object definition sections have nearly the same structure - help illustrate that through consistent naming. Change-Id: Ibed374fca4883a293a7fc16b36034e1acb38362a Reviewed-on: https://go-review.googlesource.com/c/go/+/677378 Auto-Submit: Mark Freeman <mark@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-02cmd/compile/internal/noder: begin filling in SectionObjMark Freeman
SectionObj has to encode the definition information for each object type, so it will be a bit long. Change-Id: I9b9514d58a284a4e64020f99fd1b2a92f7752338 Reviewed-on: https://go-review.googlesource.com/c/go/+/677377 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <mark@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-02cmd/compile/internal/noder: fill in SectionNameMark Freeman
Change-Id: Ib99d40a546cb095c1b6c2d33e0735f3b5c681539 Reviewed-on: https://go-review.googlesource.com/c/go/+/677237 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <mark@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-29cmd/compile/internal/noder: rename RelIndex to match codebaseMark Freeman
Change-Id: I06b64ea3c1c02b46e242852f8f0b56d77df42161 Reviewed-on: https://go-review.googlesource.com/c/go/+/677236 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Mark Freeman <mark@golang.org> Reviewed-by: Robert Griesemer <gri@google.com>
2025-05-20internal/pkgbits: rename RelocEnt to RefTableEntryMark Freeman
Change-Id: I9b1c9a0499ad3444e8cb3e4be187f9fab816c90c Reviewed-on: https://go-review.googlesource.com/c/go/+/674159 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <mark@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-20cmd/compile/internal/noder: mark Ref[T] as a primitiveMark Freeman
Like Sync, Ref[T] is also used to define things like StringRef. Change-Id: I9e10234504ee4dd03907bb058a6f3ae7e6a287ca Reviewed-on: https://go-review.googlesource.com/c/go/+/674157 Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Bypass: Mark Freeman <mark@golang.org> Auto-Submit: Mark Freeman <mark@golang.org>
2025-05-19cmd/compile/internal/noder: mark Sync as a primitiveMark Freeman
Sync is used in the definition of primitives and documented by pkgbits. It's not much help to also document it here. Change-Id: I18bd0c7816f8249483550a1f0af7c76b9cfe09fb Reviewed-on: https://go-review.googlesource.com/c/go/+/674156 Auto-Submit: Mark Freeman <mark@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Bypass: Mark Freeman <mark@golang.org>
2025-05-19cmd/compile/internal/noder: document SectionPkgMark Freeman
The package section holds package stubs, which are a package (path, name) pair and a series of declared imports. Change-Id: If2a260c5e0a3522851be9808de46a3f128902002 Reviewed-on: https://go-review.googlesource.com/c/go/+/674175 Auto-Submit: Mark Freeman <mark@golang.org> TryBot-Bypass: Mark Freeman <mark@golang.org> Reviewed-by: Robert Griesemer <gri@google.com>
2025-05-19cmd/compile/internal/noder: format grammarMark Freeman
This just wraps column width to 72 and indents production definitions so they are easier to distinguish from prose. Change-Id: I386b122b4f617db4b182ebb549fbee4f35a0122c Reviewed-on: https://go-review.googlesource.com/c/go/+/673536 TryBot-Bypass: Mark Freeman <mark@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <mark@golang.org>
2025-05-19cmd/compile/internal/noder: document the PosBase sectionMark Freeman
Positions mostly borrow their representation from package syntax. Of note, constants (such as the zero value for positions) are not encoded directly. Rather, a flag typically signals such values. Change-Id: I6b4bafc6e96bb21902dd2d6e164031e7dd5aabdd Reviewed-on: https://go-review.googlesource.com/c/go/+/673535 TryBot-Bypass: Mark Freeman <mark@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <mark@golang.org>
2025-05-14internal/pkgbits, cmd/compile/internal/noder: document string sectionMark Freeman
To understand this change, we begin with a short description of the UIR file format. Every file is a header followed by a series of sections. Each section has a kind, which determines the type of elements it contains. An element is just a collection of one or more primitives, as defined by package pkgbits. Strings have their own section. Elements in the string section contain only string primitives. To use a string, elements in other sections encode a reference to the string section. To illustrate, consider a simple file which exports nothing at all. package p In the meta section, there is an element representing a package stub. In that package stub, a string ("p") represents both the path and name of the package. Again, these are encoded as references. To manage references, every element begins with a reference table. Instead of writing the bytes for "p" directly, the package stub encodes an index in this reference table. At that index, a pair of numbers is stored, indicating: 1. which section 2. which element index within the section Effectively, elements always use *2* layers of indirection; first to the reference table, then to the bytes themselves. With some minor hand-waving, an encoding for the above package is given below, with (S)ections, (E)lements and (P)rimitives denoted. + Header | + Section Ends // each section has 1 element | | + 1 // String is elements [0, 1) | | + 2 // Meta is elements [1, 2) | + Element Ends | | + 1 // "p" is bytes [0, 1) | | + 6 // stub is bytes [1, 6) + Payload | + (S) String | | + (E) String | | | + (P) String { byte } 0x70 // "p" | + (S) Meta | | + (E) Package Stub | | | + Reference Table | | | | + (P) Entry Count uvarint 1 // there is a single entry | | | | + (P) 0th Section uvarint 0 // to String, 0th section | | | | + (P) 0th Index uvarint 0 // to 0th element in String | | | + Internals | | | | + (P) Path uvarint 0 // 0th entry in table | | | | + (P) Name uvarint 0 // 0th entry in table Note that string elements do not have reference tables like other elements. They behave more like a primitive. As this is a bit complicated and getting into details of the UIR file format, we omit some details in the documentation here. The structure will become clearer as we continue documenting. Change-Id: I12a5ce9a34251c5358a20f2f2c4d0f9bd497f4d0 Reviewed-on: https://go-review.googlesource.com/c/go/+/671997 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <mark@golang.org> TryBot-Bypass: Mark Freeman <mark@golang.org>
2025-05-12internal/pkgbits: rename Reloc* to Section*Mark Freeman
This is a basic refactoring. This enumeration refers primarily to the different sections of a UIR file, so this naming is a bit more direct. Change-Id: Ib70ab054e97effaabc035450d246ae4354da8075 Reviewed-on: https://go-review.googlesource.com/c/go/+/671935 Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Mark Freeman <mark@golang.org>
2025-05-09cmd/compile/internal/noder: begin documenting meta sectionMark Freeman
Meta is the most fundamental section. To flesh this out, we discuss references. Primitives are briefly mentioned by pointing to pkgbits, where they will be defined using a similar grammar. Change-Id: I7abd899f38fad4cc5caf87ebfc7aa1b1985b17d4 Reviewed-on: https://go-review.googlesource.com/c/go/+/671176 Auto-Submit: Mark Freeman <mark@golang.org> TryBot-Bypass: Mark Freeman <mark@golang.org> Reviewed-by: Robert Griesemer <gri@google.com>
2025-05-08cmd/compile/internal/noder: begin a formal UIR grammar.Mark Freeman
The UIR export data format can be reasonably expressed using EBNF. The noder owns the definition of the export data format, so this seems like a reasonable place to put this. Change-Id: I0205ab29a3c5e57d670d7fd3164a8bd604ab8e59 Reviewed-on: https://go-review.googlesource.com/c/go/+/670616 Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Bypass: Mark Freeman <mark@golang.org> Auto-Submit: Mark Freeman <mark@golang.org>