Skip to content

Commit f51cf61

Browse files
committed
docs: the implementation record of the pack drive and selection design (2026.10.1.2)
1 parent 8eecd2e commit f51cf61

1 file changed

Lines changed: 70 additions & 1 deletion

File tree

‎.agents/docs/2026-10-01-pack-drive-and-selection-independent-compile-design.md‎

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ status: active
55

66
# A pack's build reported as a build, and a unit's compile independent of the member selection: triage and design (#753, #751)
77

8-
- Status: revision 2, being implemented as 2026.10.1.2.
8+
- Status: implemented as 2026.10.1.2 (pull request #754). Section 15 records
9+
what was built, what was measured, and where the implementation departs
10+
from sections 3, 4 and 10.
911
- Revision 1 was reviewed on 2026-10-01. D1 to D4 were accepted as
1012
recommended: one placement rule for every plan, uniform PIC on ELF
1113
targets subject to M3, the module map as an argument file, and every
@@ -557,3 +559,70 @@ command lines that T7's criteria compare.
557559
| openxlings/xlings | Release canary; built and tested with the release in the sandbox; no change expected | T11, T12 |
558560
| openxlings/xim-pkgindex | The release workflow opens the version bump; merged by a maintainer | T11 |
559561
| mcpp-community/mcpp-index | The `latest_mcpp` pin moves to the release, and the full sweep runs | T11 |
562+
563+
## 15. Implementation record
564+
565+
### 15.1 Departures from sections 3, 4 and 10
566+
567+
- **The module map is per unit, not per package (B1).** `resolve_provider`
568+
answers a name's single provider whether or not it lies in the importer's
569+
closure, so a map derived from it lists other members' modules under
570+
`--workspace` and not under `-p`. A package's closure also differs between
571+
`mcpp build` and `mcpp test`, which adds the dev-dependencies. The map
572+
therefore lists what one unit reaches through its imports (and, for GCC,
573+
the module it provides and `std`), resolved hop by hop in each importer's
574+
closure. Units with equal maps share one file.
575+
- **A third census (B1).** The whole-argument-list criterion found that a
576+
file a member lists from outside its directory (`../shared/m.cppm`, the
577+
GalTranslPP shape) was owned by the workspace's virtual root, whose
578+
directory is the workspace's. It entered the root's basename census, so its
579+
object was `obj/m.m.o` under `-p` and `obj/core/__pkg/workspace/shared/m.m.o`
580+
under `--workspace`. A workspace plan's root now owns no source; such a unit
581+
belongs to the member that declares it.
582+
- **The map's key.** A module and a unit that imports it can hold the same map
583+
and differ in what they load (only the importer has an argument file). The
584+
key hashes the map and the relative paths the argument file loads, so it is
585+
the same in every build directory, as the map is.
586+
- **`emit build-database` writes the maps** into its work directory, so a
587+
reader that expands the argument files finds them.
588+
- **The cache artifact.** `DepArtifacts` names each BMI's build path in a
589+
vector of pairs (`BmiPlacement`). A `std::map<std::string, std::string,
590+
std::less<>>` in that struct made clang 22.1.8 crash (SIGSEGV in
591+
`ASTReader::readTypeRecord`) compiling every importer of
592+
`mcpp.build.prepare` that instantiates a ranges algorithm, on Linux and
593+
macOS; GCC 16 compiled it. The first CI round of #754 failed on every macOS
594+
leg for this reason, and the cause was bisected locally.
595+
- **B2's predicate** is "ELF and not freestanding", read from the target
596+
triple with the host triple when the target is empty. Mach-O is excluded
597+
because its compilers default to PIC; WebAssembly refuses shared objects.
598+
- **A2.** `mcpp test`'s bulk, per-test and per-member drives pass `Caller`.
599+
The dispatch pass of a pack reopens the report, because `Finished` closes
600+
it. The library pack and the Android legs are reported by the default.
601+
- **e2e numbers.** 860 and 861 were already taken on main, so the criteria of
602+
section 10 are e2e 871 (A) and 872 (B). e2e 847 G holds unchanged (the
603+
updater alone is a root package); 847 A, 09 and 849 B are restated for the
604+
new placement.
605+
606+
### 15.2 Measurements
607+
608+
- **M3, GCC 16.1.0, mcpp's own release build (`--cache off`), the same
609+
sources built by 2026.10.1.1 (no PIC) and by this branch (PIC):** wall time
610+
111.52 s and 111.95 s; binary 25,184,592 and 25,227,320 bytes (+0.17%), text
611+
11,669,387 and 11,684,419 bytes; a full plan of the mcpp tree (`emit
612+
build-database`, median of ten alternating runs) 0.167 s and 0.169 s.
613+
- **The reproductions of section 2 on this branch:** F6 and F8 compile nothing
614+
after the first `--workspace`; F7's `--workspace` after `-p app` and
615+
`-p tool` archives `bin/core/libcore.a`, the one product neither `-p` build
616+
needs, and compiles nothing.
617+
- **Self-hosting:** mcpp builds itself with this branch under GCC 16 (204
618+
module maps; a repeat build is a no-op; an edit recompiles one unit) and
619+
under clang 22 (`--dev`).
620+
- **Local suites (clang 22 default host):** unit tests 143 of 143; e2e 477
621+
passed, 21 failed, 61 skipped, and each of the 21 fails in the same way on
622+
2026.10.1.1 except 872, whose run used a binary older than its script, and
623+
178, which passed on both when repeated. e2e 871 and 872 pass under GCC 16
624+
and clang 22 and fail on 2026.10.1.1.
625+
- **The sandbox script** `.agents/docs/2026-10-01-pack-drive-and-selection-verify.sh`,
626+
on the host against this branch: 9 of 9 sections pass, xlings built from its
627+
source among them; against 2026.10.1.1 every CHANGE section fails.
628+

0 commit comments

Comments
 (0)