The backend's list ends at a whole-program compiler, not a dev one

This commit is contained in:
Joseph Ferano 2026-09-13 18:14:49 +07:00
parent c291cb7715
commit d9bc9e4190

32
NEXT.md
View File

@ -28,6 +28,38 @@ spelled out and it is the one place it is not.
The fix is a function in `runtime/` — that directory was held by another lane when this landed, which
is the whole reason it was left. Say what the caller promised and what was passed.
## The step after the backend's list, and it is the one the backend exists for
**Named here because it is not on the list below and would otherwise be discovered late.**
Finishing items 1-6 below gives a second **whole-program** compiler. `--x86` is refused with `--dev`
today, deliberately, and `DISCUSS.md` item 16 says it has no cells. So at the end of that list the
backend can build `sand.flan` and cannot serve a single `C-c C-c`.
What the backend was for is `DISCUSS.md` item 13's measurement: `llc` and `ld` are **about 21ms of a
35ms redefinition**, and removing them is the only thing that touches that number. Collecting it means
emitting a **redefinition module** — one function, compiled and installed into a running process
through an indirection cell — which is what `Build.shared` does on the LLVM path.
Concretely, and none of it is scoped yet:
- **`Fnval`'s indirection cell.** Item 4 below. `FnAddr (Fnval n)` emits the symbol, which is right
for a whole-program build and wrong the instant anything is redefined into it. This is the
prerequisite and it is already on the list; what follows is not.
- **A module rather than a program.** `Build.shared` compiles one function to a `.so` that
`flan_dev.c` loads. The x86 path writes an assembly file for a whole program; emitting a relocatable
object for one function, with the right symbols exported and the cells left external, is different
work.
- **The dev registry.** A run-time-new name needs `flan_dev_cell`. `Emit.redefinition` already
declares 256 siblings for an imported package and that cost was measured at +3.6ms per eval; the
x86 path has no equivalent.
- **DWARF.** `flan dev --debug` exists and `--x86` refuses `--debug`. A dev backend that cannot be
debugged is a narrower tool than the one it replaces.
- **Then measure, because the whole case rests on it.** If a hand-written backend does not actually
beat 35ms end to end, the argument for it was wrong and that is worth knowing. `DISCUSS.md` item 13
says the backend is decided at step 4 on a measurement taken at step 3, and this is that
measurement finally being takeable.
## The backend, in the order that finishes it
`DISCUSS.md` item 16 is the report and its verdict is the sequencing: *"the wiring is done and it was