doc.go 1.5 KB

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