From 042ee2e22f6e2836fde61f5403cfe81780996cb0 Mon Sep 17 00:00:00 2001 From: Luis <42945842+ldiaz94@users.noreply.github.com> Date: Tue, 13 Oct 2026 18:37:38 +0100 Subject: [PATCH] Self step 5: the fixpoint self/fixpoint.sh, make fixpoint: the seed builds self/ (stage 1), that builds it (stage 2), that again (stage 3); stages 2 and 3 are the same file (so is stage 1, 547,000 bytes). Stage 3 stands in for ./raz and make check passes on it (661 tests), as does make bench (493,000 lines a second at the run, 870,000 at another). The seed's last tag can now be the bootstrap; the split of src/ is the owner's to decide. --- diff --git a/Makefile b/Makefile index a0ade28..213c4be 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,11 @@ self-bench: raz | build self/bench.sh +# the seed builds self/, that builds self/, that builds it again: the +# last two must be the same file; check and bench then run on it +fixpoint: raz | build + self/fixpoint.sh + # line numbers: gdb stops at a line and names it gdb: raz test/gdb.sh @@ -156,4 +161,4 @@ site: raz python3 site/build.py -.PHONY: units tests self self-bench check gdb bench kernels stress fmt loc man pdf dist site clean install uninstall +.PHONY: units tests self self-bench fixpoint check gdb bench kernels stress fmt loc man pdf dist site clean install uninstall diff --git a/PLAN.md b/PLAN.md index 02c8456..5d385b7 100644 --- a/PLAN.md +++ b/PLAN.md @@ -39,9 +39,12 @@ builds, tested by compiling 409 programs, the library and the compiler itself with both and comparing the executables, messages and status; 452,000 lines a second, the seed's 815,000. -5. Fixpoint: the seed builds `self`, that builds `self`, that builds - `self` again, and the last two are byte for byte the same. Then - the seed's last tag is the bootstrap, and the split of `src/` from +5. Fixpoint (done: `self/fixpoint.sh`, `make fixpoint`): the seed builds `self`, that builds `self`, that builds + `self` again, and the last two are byte for byte the same (all + three are, 547,000 bytes: the seed and this compiler make the same + code from `self/`). `make check` passes on the compiler it made, + 661 tests, and `make bench` gives 493,000 to 870,000 lines a second. + Then the seed's last tag is the bootstrap, and the split of `src/` from the rest is the owner's to decide. Done when step 5 passes with `make check` and `make bench` on the diff --git a/self/README.md b/self/README.md index d9f8799..3e17d74 100644 --- a/self/README.md +++ b/self/README.md @@ -9,6 +9,7 @@ make self # each unit against the seed's, on the same files make self-bench # the scanner's speed against the seed's + make fixpoint # the seed builds self, that builds self, that builds it again `Chunk` and `Sym` have no input files to read, so each has a dumper pair, `test/ChunkDump` and `test/SymDump`, that runs one fixed @@ -48,6 +49,14 @@ options each test has. The executable, the messages, and the status must be the same for every file: 409 of them, 289 of which are errors. `make self-bench` gives the speed of both. + +`make fixpoint` (`fixpoint.sh`) is the proof that the port is whole: +the seed builds `Raz.raz` (stage 1), stage 1 builds it (stage 2), and +stage 2 builds it again (stage 3). Stages 2 and 3 must be the same +file; they are, and so is stage 1, since the seed and the port make the +same code. Stage 3 then stands in for `./raz`, and `make check` and +`make bench` run on it. Each stage is built by the same command in the +same place, since a program holds the paths it was made from. `check.sh` builds a dumper for each side, `test/ScanDump.pas` over the seed's units and `test/ScanDump.raz` over these, and has both read the diff --git a/self/fixpoint.sh b/self/fixpoint.sh new file mode 100755 index 0000000..fdd34f6 --- /dev/null +++ b/self/fixpoint.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# The fixpoint: the seed builds self/ (stage 1), that builds self/ +# (stage 2), that builds it again (stage 3), and stages 2 and 3 must +# be the same file. A program holds the paths it was made from, so each +# stage is built by the same command in the same place, from the +# compiler before it copied to build/fix/raz. Run from the repository +# root, after `make raz`. Then stage 3 stands in for ./raz (messages name +# the library by its path from the compiler, so it must be at the root) +# while `make check` and `make bench` run on it; the seed's comes back. +set -e +d=build/fix +rm -rf $d +mkdir -p $d/v +ln -s ../../lib $d/lib +printf 'module Version;\nconst Text* = "%s";\nend Version.\n' "$(tr -d "'" < build/version.inc)" >$d/v/Version.raz +cp raz $d/stage0 +for n in 1 2 3; do + cp $d/stage$((n - 1)) $d/raz + $d/raz -Werror -I self -I $d/v -o $d/stage$n self/Raz.raz +done +cmp $d/stage2 $d/stage3 +echo "fixpoint: stages 2 and 3 are the same, $(wc -c <$d/stage3) bytes" +cp raz $d/seed +trap 'cp $d/seed raz' EXIT +cp $d/stage3 raz +make check +make bench