cmd: compile packages from direct exports
This commit is contained in:
@@ -2802,15 +2802,28 @@ the final component of its import path; two logical identities for one physical
|
||||
directory are rejected rather than compiled twice.
|
||||
|
||||
Packages compile serially in dependency-first postorder. The compiler emits the
|
||||
existing deterministic `.wwi` interface for every importable package and only
|
||||
exported declarations enter that interface. A source qualifier is visible only
|
||||
when its owning package directly imports it; private members and transitive-only
|
||||
qualifiers are compiler errors. For compatibility with public signatures that
|
||||
name deeper types, composed compiler units still carry transitive interface type
|
||||
facts for internal resolution, but those facts do not create source-visible
|
||||
bare names, package qualifiers, or value bindings. Replacing that
|
||||
source-like closure with a self-contained typed export encoding remains part of
|
||||
the later export-format work, not package-loader semantics.
|
||||
existing deterministic `.wwi` interface for every importable package. Its
|
||||
primary section contains that package's byte-sorted direct imports and exported
|
||||
declarations. The compiler then appends byte-sorted, origin-tagged sections for
|
||||
only the exported foreign type and constant facts recursively reachable from
|
||||
the primary public signatures. This makes each direct dependency interface
|
||||
self-contained for the public type information its consumers need while
|
||||
retaining the deeper declarations' original package identity. Checked fixed
|
||||
array dimensions are emitted as numeric type facts, so a public layout never
|
||||
requires exposing the private constant spelling that produced its length.
|
||||
|
||||
A package compilation unit contains one `.wwi` for each byte-sorted **direct**
|
||||
import and no separately injected transitive interface. Origin-tagged facts
|
||||
inside those direct artifacts are compiler data, not source imports: a source
|
||||
qualifier is visible only when its owning package directly imports it, and
|
||||
private members, transitive-only qualifiers, bare values, and bare types remain
|
||||
compiler errors. In `-c` package mode the compiler coalesces repeated exported
|
||||
type/constant facts with the same origin, kind, and name, preserving one nominal
|
||||
type identity across diamonds; raw non-package `w6c` retains its existing
|
||||
duplicate behavior. The source-like `.wwi` syntax remains a transitional export
|
||||
encoding pending the binary `.wwe` format described above, but the direct-input
|
||||
ownership boundary is now live in production Cstage and WWstage compilers and
|
||||
drivers.
|
||||
|
||||
An ordinary root is linked with the full reachable object closure into the
|
||||
requested executable (legacy WW programs may use a package name other than
|
||||
@@ -2821,7 +2834,10 @@ identity (`ww build -p -I ROOT -o bar.a foo.bar` emits `foo.bar.*` symbols),
|
||||
while a literal directory uses its declared leaf package. Package output
|
||||
requires a directory and `-p` cannot be combined with assembly-only `-S`. Two
|
||||
cold builds with identical inputs are required to produce byte-identical
|
||||
requested products.
|
||||
requested products. Compiler intrinsics keep their package-mode runtime ABI
|
||||
independent of transitive source interfaces (for example, `alloc` lowers to the
|
||||
runtime allocator without requiring an `rt.wwi` compiler input), while the
|
||||
linker still receives every reachable package archive plus the runtime archive.
|
||||
|
||||
## 12. Candidate architectures and hard-gate decision
|
||||
|
||||
|
||||
Reference in New Issue
Block a user