doc.go (1543B)
1 // Copyright 2022 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Package pkgbits implements low-level coding abstractions for 6 // Unified IR's export data format. 7 // 8 // At a low-level, a package is a collection of bitstream elements. 9 // Each element has a "kind" and a dense, non-negative index. 10 // Elements can be randomly accessed given their kind and index. 11 // 12 // Individual elements are sequences of variable-length values (e.g., 13 // integers, booleans, strings, go/constant values, cross-references 14 // to other elements). Package pkgbits provides APIs for encoding and 15 // decoding these low-level values, but the details of mapping 16 // higher-level Go constructs into elements is left to higher-level 17 // abstractions. 18 // 19 // Elements may cross-reference each other with "relocations." For 20 // example, an element representing a pointer type has a relocation 21 // referring to the element type. 22 // 23 // Go constructs may be composed as a constellation of multiple 24 // elements. For example, a declared function may have one element to 25 // describe the object (e.g., its name, type, position), and a 26 // separate element to describe its function body. This allows readers 27 // some flexibility in efficiently seeking or re-reading data (e.g., 28 // inlining requires re-reading the function body for each inlined 29 // call, without needing to re-read the object-level details). 30 // 31 // This is a copy of internal/pkgbits in the Go implementation. 32 package pkgbits