Просмотр исходного кода

docs: record separate compilation

Eric Streit 9 часов назад
Родитель
Сommit
bfe471cf78

+ 3 - 0
docs/INDEX.md

@@ -59,6 +59,9 @@ bisecting *why* a decision was made, not for reading end-to-end).
 
 ## Recent session summaries (newest first)
 
+- **`summary_session-2026-10-24-separate-compilation.md`** — core
+  per-object compilation, stable symbols, init ordering, M2make
+  `--separate`; tag `v3-separate-compilation`.
 - **`summary_session-2026-10-24-library-folders.md`** — dialect library
   layout (`lib/pim`, `lib/iso`, `lib/common`, `lib/gm2`); tag
   `v3-library-folders`.

+ 2 - 1
docs/STATUS.md

@@ -203,7 +203,8 @@ declarations still work (`t_fwdproc`, `t_fwdok`).
    dependency-ordered init calls.  `M2make --separate` resolves
    interfaces and links objects.  Core shipped; generics, incremental
    builds and an `M2 -I` scanner remain.  See
-   `docs/separate-compilation.md`.
+   `docs/separate-compilation.md`;
+   summary: `summary_session-2026-10-24-separate-compilation.md`.
 5. **Library folders** — `stdlib/` is retired; libraries live in
    `lib/pim`, `lib/iso`, `lib/common` and `lib/gm2`, with the shared
    runtime in `runtime/syslib`.  M2make selects a dialect with

+ 2 - 1
docs/handoff-2026-10-23-next.md

@@ -165,7 +165,8 @@ separate compilation.
 - Stable symbols: `<Module>__<proc>`, `<Module>_<global>`,
   module-qualified pools, `<Module>__<Class>__vt`; all top-level data is
   `export data`.
-- See `docs/separate-compilation.md`.  Deferred: `M2 -I` import
+- See `docs/separate-compilation.md` and
+  `summary_session-2026-10-24-separate-compilation.md`.  Deferred: `M2 -I` import
   scanner, incremental builds, generic-object emission, ABI marker,
   and self-hosting via per-object builds.
 - Library folders are **done**: `lib/pim`, `lib/iso`, `lib/common`,

+ 72 - 0
docs/summary_session-2026-10-24-separate-compilation.md

@@ -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.