|
|
@@ -0,0 +1,72 @@
|
|
|
+# Session 2026-10-24 — separate compilation (core)
|
|
|
+
|
|
|
+V3 now builds per-unit objects. The one-shot mode remains the default
|
|
|
+for the suite/corpus.
|
|
|
+
|
|
|
+**Branch:** `master`. **Feature state:** `v3-separate-compilation`.
|
|
|
+**Gates:** suite **303/303**, fixpoint **OK (3,717,887 bytes)**,
|
|
|
+corpus **519/612 compile-OK, 0 crashes**.
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+## What shipped
|
|
|
+
|
|
|
+- **Stable symbols**
|
|
|
+ - module procedure: `<Module>__<name>`
|
|
|
+ - module global: `<Module>_<name>`
|
|
|
+ - string/ctor/set pools: `<Module>_strN`, `<Module>_ctoN`,
|
|
|
+ `<Module>_setN`
|
|
|
+ - class vtable: `<Module>__<Class>__vt`; methods include their class
|
|
|
+ - nested procedures: object-local module-prefixed uid
|
|
|
+ - external C procedures: C link name unchanged
|
|
|
+- **Per-unit codegen**
|
|
|
+ - `M2 -c Target.mod` emits one `.ssa`; the target's own `.def` is
|
|
|
+ found beside it automatically.
|
|
|
+ - Library objects have **no `main`**; the program object has the
|
|
|
+ only `main`.
|
|
|
+ - Every object exports `<Module>_init`, including modules with no
|
|
|
+ `BEGIN` body; the program calls imported inits in dependency order.
|
|
|
+ - Top-level data is `export data`, so imported globals resolve.
|
|
|
+- **Driver**
|
|
|
+ - `M2 -c` lowers the target `.mod` and its own `.def` (for exported
|
|
|
+ data), skips imported definition units, and records imported init
|
|
|
+ calls.
|
|
|
+ - `M2make --separate` scans imports transitively, compiles each unit
|
|
|
+ to `gen_ssa/<Module>.o`, and links all objects with `cc` + shim.
|
|
|
+- **Classes**
|
|
|
+ - stable vtable/method symbols; a manual imported-class virtual call
|
|
|
+ links and returns 42. Client objects do not duplicate imported
|
|
|
+ vtables.
|
|
|
+
|
|
|
+## Tests
|
|
|
+
|
|
|
+Added `SepLib`/`SepProg` and `SepEmpty`/`SepEmptyProg`:
|
|
|
+- library object contains no `main`;
|
|
|
+- program object contains `main` and links against only the library
|
|
|
+ object (not its `.mod`);
|
|
|
+- exported data + library BEGIN works (`42`);
|
|
|
+- bodyless library still exports init and links (`42`).
|
|
|
+
|
|
|
+Manual M2make cross-object class check: `CLib.def/.mod` + `CProg.mod`
|
|
|
+→ virtual `Area()` = 42.
|
|
|
+
|
|
|
+## Limits
|
|
|
+
|
|
|
+- `M2 -c` requires imported interfaces on the command line; `M2 -I`
|
|
|
+ import scanning is deferred. `M2make --separate` is the transitive
|
|
|
+ resolver.
|
|
|
+- `--separate` rebuilds all objects (no incremental build/ABI marker).
|
|
|
+- Generics still need the generic body at the client; no separate
|
|
|
+ generic-instance object emission yet.
|
|
|
+- The fixpoint gate still compares the one-shot compiler image, not a
|
|
|
+ multi-object self-host.
|
|
|
+
|
|
|
+## Commits and tags
|
|
|
+
|
|
|
+| commit | tag | work |
|
|
|
+| --- | --- | --- |
|
|
|
+| `0adc637` | `v3-separate-compilation` | stable symbols, `-c`, library/program split, init list, M2make `--separate`, tests/docs |
|
|
|
+| this docs commit | `v3-separate-compilation-summary` | session summary |
|
|
|
+| final docs commit | `v3-session-2026-10-24-separate-end` | session tag |
|
|
|
+
|
|
|
+No push was performed.
|