raz / commit 042ee2e2

commit
042ee2e22f6e2836fde61f5403cfe81780996cb0
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
7797fa8a
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.

patch · log

4 files changed, +48 -4

Makefile (history) modified +6 -1

@@ -42,6 +42,11 @@
4242 self-bench: raz | build
4343 self/bench.sh
4444
45+# the seed builds self/, that builds self/, that builds it again: the
46+# last two must be the same file; check and bench then run on it
47+fixpoint: raz | build
48+ self/fixpoint.sh
49+
4550 # line numbers: gdb stops at a line and names it
4651 gdb: raz
4752 test/gdb.sh
@@ -156,4 +161,4 @@
156161 site: raz
157162 python3 site/build.py
158163
159-.PHONY: units tests self self-bench check gdb bench kernels stress fmt loc man pdf dist site clean install uninstall
164+.PHONY: units tests self self-bench fixpoint check gdb bench kernels stress fmt loc man pdf dist site clean install uninstall

PLAN.md (history) modified +6 -3

@@ -39,9 +39,12 @@
3939 builds, tested by compiling 409 programs, the library and the compiler
4040 itself with both and comparing the executables, messages and status;
4141 452,000 lines a second, the seed's 815,000.
42-5. Fixpoint: the seed builds `self`, that builds `self`, that builds
43- `self` again, and the last two are byte for byte the same. Then
44- the seed's last tag is the bootstrap, and the split of `src/` from
42+5. Fixpoint (done: `self/fixpoint.sh`, `make fixpoint`): the seed builds `self`, that builds `self`, that builds
43+ `self` again, and the last two are byte for byte the same (all
44+ three are, 547,000 bytes: the seed and this compiler make the same
45+ code from `self/`). `make check` passes on the compiler it made,
46+ 661 tests, and `make bench` gives 493,000 to 870,000 lines a second.
47+ Then the seed's last tag is the bootstrap, and the split of `src/` from
4548 the rest is the owner's to decide.
4649
4750 Done when step 5 passes with `make check` and `make bench` on the

self/README.md modified +9 -0

@@ -9,6 +9,7 @@
99
1010 make self # each unit against the seed's, on the same files
1111 make self-bench # the scanner's speed against the seed's
12+ make fixpoint # the seed builds self, that builds self, that builds it again
1213
1314 `Chunk` and `Sym` have no input files to read, so each has a dumper
1415 pair, `test/ChunkDump` and `test/SymDump`, that runs one fixed
@@ -48,6 +49,14 @@
4849 options each test has. The executable, the messages, and the status
4950 must be the same for every file: 409 of them, 289 of which are errors.
5051 `make self-bench` gives the speed of both.
52+
53+`make fixpoint` (`fixpoint.sh`) is the proof that the port is whole:
54+the seed builds `Raz.raz` (stage 1), stage 1 builds it (stage 2), and
55+stage 2 builds it again (stage 3). Stages 2 and 3 must be the same
56+file; they are, and so is stage 1, since the seed and the port make the
57+same code. Stage 3 then stands in for `./raz`, and `make check` and
58+`make bench` run on it. Each stage is built by the same command in the
59+same place, since a program holds the paths it was made from.
5160
5261 `check.sh` builds a dumper for each side, `test/ScanDump.pas` over the
5362 seed's units and `test/ScanDump.raz` over these, and has both read the

self/fixpoint.sh added (executable) +27 -0

@@ -0,0 +1,27 @@
1+#!/bin/sh
2+# The fixpoint: the seed builds self/ (stage 1), that builds self/
3+# (stage 2), that builds it again (stage 3), and stages 2 and 3 must
4+# be the same file. A program holds the paths it was made from, so each
5+# stage is built by the same command in the same place, from the
6+# compiler before it copied to build/fix/raz. Run from the repository
7+# root, after `make raz`. Then stage 3 stands in for ./raz (messages name
8+# the library by its path from the compiler, so it must be at the root)
9+# while `make check` and `make bench` run on it; the seed's comes back.
10+set -e
11+d=build/fix
12+rm -rf $d
13+mkdir -p $d/v
14+ln -s ../../lib $d/lib
15+printf 'module Version;\nconst Text* = "%s";\nend Version.\n' "$(tr -d "'" < build/version.inc)" >$d/v/Version.raz
16+cp raz $d/stage0
17+for n in 1 2 3; do
18+ cp $d/stage$((n - 1)) $d/raz
19+ $d/raz -Werror -I self -I $d/v -o $d/stage$n self/Raz.raz
20+done
21+cmp $d/stage2 $d/stage3
22+echo "fixpoint: stages 2 and 3 are the same, $(wc -c <$d/stage3) bytes"
23+cp raz $d/seed
24+trap 'cp $d/seed raz' EXIT
25+cp $d/stage3 raz
26+make check
27+make bench