| | @@ -0,0 +1,299 @@ |
| 1 | +# Handover, 2026-10-17 |
| 2 | + |
| 3 | +Where the work stands, what to tag where, and how to go on. Delete this |
| 4 | +file once v0.20.0 is out. |
| 5 | + |
| 6 | +## What to tag |
| 7 | + |
| 8 | +This session could push to `main` but not tags (the environment's git |
| 9 | +proxy refused them, 403), so the tags are the owner's to add, |
| 10 | +retrospectively. Each is an annotated tag whose message is what |
| 11 | +`raz --version` prints; pushing it runs CI, which checks the commit and |
| 12 | +makes the GitHub release with its tarball. |
| 13 | + |
| 14 | +| Tag | Commit | Message | Note | |
| 15 | +|---|---|---|---| |
| 16 | +| `v0.18.1` | `88b18ba` ("Docs for v0.18.1") | `raz 0.18.1, report 2026-10.32` | Never tagged, though CLAUDE.md and README call it a release; `1328b81` ("site: v0.18.1") follows it. Check the commit before tagging. | |
| 17 | +| `v0.19.0` | `51a90a6` | `raz 0.19.0, report 2026-10.33` | Its tarball's SHA-256 is `217448cb6521c76a28d71499d70a5dfdebc2dbcbc81d6d41ed9d9590005772ed` (made here by `make dist REV=v0.19.0`). | |
| 18 | + |
| 19 | + git tag -a v0.18.1 -m 'raz 0.18.1, report 2026-10.32' 88b18ba |
| 20 | + git tag -a v0.19.0 -m 'raz 0.19.0, report 2026-10.33' 51a90a6 |
| 21 | + git push origin v0.18.1 v0.19.0 |
| 22 | + |
| 23 | +Tarballs are the same byte for byte wherever they are made: v0.18.0's, |
| 24 | +made here, has GitHub's SHA-256 (`d05f2adb...`). So CI's v0.19.0 |
| 25 | +tarball should have the sum above; check it (`gh api |
| 26 | +repos/ldiaz94/raz/releases/tags/v0.19.0`, then the asset) before going |
| 27 | +on, since v0.20.0 pins it. |
| 28 | + |
| 29 | +## What is done (on `main`) |
| 30 | + |
| 31 | +v0.19.0, report 2026-10.33, the ninth thaw, by the owner's word: a |
| 32 | +`const` parameter, a variant in a constant, and the library taking |
| 33 | +`var`, `const` or a value where it took a pointer. Commits `71db16c` |
| 34 | +(report) to `51a90a6` (docs; the compiler follows 10.33), then |
| 35 | +`d704863` (PROPOSALS.md: the done parts out; `[]const T` in). Each |
| 36 | +commit passed `make check`; the fixpoint, `stress`, `kernels` and |
| 37 | +`tests` passed at the end. Notes: |
| 38 | + |
| 39 | +- `bench` dipped below 400,000 lines a second on some runs in this |
| 40 | + container; the new compiler was about 9% faster than the one before |
| 41 | + the work on the same machine, so it is the machine's load. |
| 42 | +- Measured: `Map.get` and `Vec.all` taking their record as a value made |
| 43 | + a loop half again as slow; as `const` the code is the pointer's, so |
| 44 | + they take `const`. `Buf.bytes` (a value) and `Sys.entryKind` (`var`) |
| 45 | + wait for v0.20.0, since the seed compiles them and doesn't know |
| 46 | + `const`. |
| 47 | +- A trace no longer shows `var` or `const` parameters (four `.stderr` |
| 48 | + files regenerated). |
| 49 | +- The report is about 32 pages of 40 by its words; this container's |
| 50 | + pandoc is too old for `make pdf`. Check it by hand. |
| 51 | + |
| 52 | +## v0.20.0: what is left |
| 53 | + |
| 54 | +The plan, approved: v0.19.0 builds `src/`, the Pascal seed goes, then |
| 55 | +what waited for that. |
| 56 | + |
| 57 | +1. **Build from v0.19.0; drop the seed** (started here, not committed; |
| 58 | + see below). Needs the v0.19.0 release to exist, for CI. |
| 59 | +2. **`Buf.bytes` and `Sys.entryKind` take `const`** (both `Sys` |
| 60 | + files), with volume 2 and `test/doc`. No caller changes. |
| 61 | +3. **`src/`'s records only read take `const`** (`Item`, about 130 |
| 62 | + bytes, in `Item.what`, `adrOf`, `realOf`, `discard` and the like), |
| 63 | + kept only where `make bench` gains. |
| 64 | +4. Docs: README (building, "What's here", the seed), CLAUDE.md (the |
| 65 | + setup list loses `make tests` and `seed-bench`, gains `prev-bench`; |
| 66 | + "The compiler and the seed"; the readings that keep `Sys.raz`, |
| 67 | + `CAbi`, `src/` and its library to the seed's language, and that say |
| 68 | + views and the widening wait for a new seed), `doc/compiler.md`'s |
| 69 | + opening, `src/README.md`, and comments in `src/*.raz` that name the |
| 70 | + seed. `fpc` stays only for `make kernels`' Pascal twins. |
| 71 | +5. Tag `v0.20.0` (`raz 0.20.0, report 2026-10.33`). |
| 72 | + |
| 73 | +Also waiting, not started: `PTR(s)` in PROPOSALS.md, which the owner |
| 74 | +thought worth doing; it is a library/built-in addition that breaks no |
| 75 | +program. |
| 76 | + |
| 77 | +## Step 1 as it was left |
| 78 | + |
| 79 | +Not committed; this container's working tree had it, and it is |
| 80 | +repeated here so that a fresh session can make it again. Untested |
| 81 | +beyond `make raz` (which built `raz 0.19.0-1-...` from build/boot/raz). |
| 82 | + |
| 83 | +- `BOOT`, one line: `v0.19.0 217448cb6521c76a28d71499d70a5dfdebc2dbcbc81d6d41ed9d9590005772ed` |
| 84 | +- `src/boot.sh`, executable: fetches the tarball BOOT names into |
| 85 | + `build/boot/` (curl for a public repository; `gh api` REST for this |
| 86 | + private one: GraphQL, which `gh release download` uses, is refused |
| 87 | + from these sessions), checks its SHA-256, puts its `raz` at |
| 88 | + `build/boot/raz` with `ln -sfn ../../lib build/boot/lib`. CI's check |
| 89 | + step then needs `GH_TOKEN: ${{ github.token }}` in its env, and no |
| 90 | + longer needs `fp-compiler`. |
| 91 | +- `git rm -r seed test/scantest.pas test/enctest.pas test/handtest.pas |
| 92 | + src/test/ScanBench.pas src/test/ScanBench.raz`. |
| 93 | +- The Makefile, `src/fixpoint.sh` (stage 0 is `build/boot/raz`) and |
| 94 | + `src/bench.sh` (now `make prev-bench`: this compiler against BOOT's, |
| 95 | + failing if more than a tenth slower), as in this diff: |
| 96 | + |
| 97 | +``` |
| 98 | +diff --git a/Makefile b/Makefile |
| 99 | +index cad4c6d..6a20acd 100644 |
| 100 | +--- a/Makefile |
| 101 | ++++ b/Makefile |
| 102 | +@@ -1,19 +1,15 @@ |
| 103 | + # Builds the compiler, raz, from src/ into the repository's root; the |
| 104 | +-# library it needs is lib/, beside it. The seed, the Pascal compiler in |
| 105 | +-# seed/, builds it: fpc makes the seed in build/seed/ (with lib/ beside |
| 106 | +-# it, as every raz has), and the seed compiles src/. The one module |
| 107 | +-# the build makes, Version, holds what git says the version is. |
| 108 | ++# library it needs is lib/, beside it. The previous release builds it: |
| 109 | ++# BOOT names that release and its tarball's SHA-256, and src/boot.sh |
| 110 | ++# puts its raz in build/boot/, with this lib/ beside it (as every raz |
| 111 | ++# has its library), so that src/ is built against today's library. The |
| 112 | ++# one module the build makes, Version, holds what git says the version is. |
| 113 | + |
| 114 | +-FPC = fpc |
| 115 | +-FPCFLAGS = -O2 -Mobjfpc -Sh- -vew -FUbuild |
| 116 | ++raz: build/boot/raz src/*.raz build/src/Version.raz |
| 117 | ++ build/boot/raz -Werror -I src -I build/src -o raz src/Raz.raz |
| 118 | + |
| 119 | +-raz: build/seed/raz src/*.raz build/src/Version.raz |
| 120 | +- build/seed/raz -Werror -I src -I build/src -o raz src/Raz.raz |
| 121 | +- |
| 122 | +-build/seed/raz: seed/*.pas build/version.inc | build |
| 123 | +- mkdir -p build/seed |
| 124 | +- $(FPC) $(FPCFLAGS) -Fibuild -FEbuild/seed -obuild/seed/raz seed/raz.pas |
| 125 | +- ln -sfn ../../lib build/seed/lib |
| 126 | ++build/boot/raz: BOOT src/boot.sh | build |
| 127 | ++ src/boot.sh |
| 128 | + |
| 129 | + build/src/Version.raz: build/version.inc | build |
| 130 | + mkdir -p build/src |
| 131 | +@@ -27,16 +23,6 @@ build/version.inc: FORCE | build |
| 132 | + |
| 133 | + FORCE: |
| 134 | + |
| 135 | +-units: seed/*.pas | build |
| 136 | +- for u in diag scan sym chunk x64 link elf; do $(FPC) $(FPCFLAGS) seed/$$u.pas || exit 1; done |
| 137 | +- |
| 138 | +-# tests of the parts below the parser, built from test/ |
| 139 | +-tests: units |
| 140 | +- $(FPC) $(FPCFLAGS) -Fuseed -obuild/scantest test/scantest.pas |
| 141 | +- $(FPC) $(FPCFLAGS) -Fuseed -obuild/enctest test/enctest.pas |
| 142 | +- $(FPC) $(FPCFLAGS) -Fuseed -obuild/handtest test/handtest.pas |
| 143 | +- build/handtest build/hand && build/hand; test $$? = 42 |
| 144 | +- |
| 145 | + build: |
| 146 | + mkdir -p build |
| 147 | + |
| 148 | +@@ -47,12 +33,13 @@ clean: |
| 149 | + check: raz build/raz-lib.3 |
| 150 | + test/check.sh |
| 151 | + |
| 152 | +-# the scanner's and the compiler's speed against the seed's |
| 153 | +-seed-bench: raz | build |
| 154 | ++# the compiler's speed against the previous release's, BOOT's, on the |
| 155 | ++# same program: fails if this one is more than a tenth slower |
| 156 | ++prev-bench: raz | build |
| 157 | + src/bench.sh |
| 158 | + |
| 159 | +-# the seed builds src/, that builds src/, that builds it again: the |
| 160 | +-# last two must be the same file; check and bench then run on it |
| 161 | ++# the previous release builds src/, that builds src/, that builds it |
| 162 | ++# again: the last two must be the same file; check and bench then run on it |
| 163 | + fixpoint: raz | build |
| 164 | + src/fixpoint.sh |
| 165 | + |
| 166 | +@@ -185,4 +172,4 @@ dist: |
| 167 | + site: raz pdf |
| 168 | + python3 site/build.py |
| 169 | + |
| 170 | +-.PHONY: units tests seed-bench fixpoint check gdb bench kernels stress alpine fmt loc man pdf dist site clean install uninstall |
| 171 | ++.PHONY: prev-bench fixpoint check gdb bench kernels stress alpine fmt loc man pdf dist site clean install uninstall |
| 172 | +diff --git a/src/bench.sh b/src/bench.sh |
| 173 | +index 5d211f3..385050d 100755 |
| 174 | +--- a/src/bench.sh |
| 175 | ++++ b/src/bench.sh |
| 176 | +@@ -1,35 +1,25 @@ |
| 177 | + #!/bin/sh |
| 178 | +-# The scanner's speed against the seed's, on the compiler's own |
| 179 | +-# benchmark program: the best of seven runs of each. Run from the |
| 180 | +-# repository root, after make raz. |
| 181 | ++# The compiler's speed against the previous release's, the one BOOT |
| 182 | ++# names (build/boot/raz), on the same generated program: the best of |
| 183 | ++# five runs of each, as build/cmp/raz, which finds the library beside |
| 184 | ++# it. A regression test: it fails if this compiler takes more than a |
| 185 | ++# tenth longer. Run from the repository root, after make raz. |
| 186 | + set -e |
| 187 | +-b=build/src |
| 188 | +-mkdir -p $b |
| 189 | +-python3 test/genbench.py 12000 >$b/Bench.raz |
| 190 | +-fpc -O2 -Mobjfpc -Sh- -vew -FUbuild -Fuseed -o$b/scanbench.seed src/test/ScanBench.pas >/dev/null |
| 191 | +-./raz -Werror -I src -o $b/scanbench.src src/test/ScanBench.raz |
| 192 | +-echo "$(wc -l <$b/Bench.raz) lines" |
| 193 | +-for t in seed src; do |
| 194 | +- best=0 |
| 195 | +- for i in 1 2 3 4 5 6 7; do |
| 196 | +- s=$(date +%s%N); $b/scanbench.$t $b/Bench.raz >/dev/null; e=$(date +%s%N) |
| 197 | +- d=$(( (e - s) / 1000000 )); if [ $best = 0 ] || [ $d -lt $best ]; then best=$d; fi |
| 198 | +- done |
| 199 | +- echo "$t: $best ms" |
| 200 | +-done |
| 201 | +- |
| 202 | +-# The whole compiler's speed, the seed's and this one's, on the same |
| 203 | +-# program: the best of five runs of each, as build/cmp/raz, which finds |
| 204 | +-# the library beside it. |
| 205 | + mkdir -p build/cmp/bench |
| 206 | + ln -sfn ../../lib build/cmp/lib |
| 207 | +-cp $b/Bench.raz build/cmp/bench/Bench.raz |
| 208 | +-for t in seed src; do |
| 209 | +- if [ $t = seed ]; then cp build/seed/raz build/cmp/raz; else cp $b/raz.src build/cmp/raz; fi |
| 210 | ++python3 test/genbench.py 12000 >build/cmp/bench/Bench.raz |
| 211 | ++echo "$(wc -l <build/cmp/bench/Bench.raz) lines" |
| 212 | ++for t in prev this; do |
| 213 | ++ if [ $t = prev ]; then cp build/boot/raz build/cmp/raz; else cp raz build/cmp/raz; fi |
| 214 | + best=0 |
| 215 | + for i in 1 2 3 4 5; do |
| 216 | + s=$(date +%s%N); build/cmp/raz -o build/cmp/bench/Bench.$t build/cmp/bench/Bench.raz; e=$(date +%s%N) |
| 217 | + d=$(( (e - s) / 1000000 )); if [ $best = 0 ] || [ $d -lt $best ]; then best=$d; fi |
| 218 | + done |
| 219 | +- echo "compile, $t: $best ms" |
| 220 | ++ echo "$t: $best ms" |
| 221 | ++ eval "ms_$t=$best" |
| 222 | + done |
| 223 | ++if [ $((ms_this * 10)) -gt $((ms_prev * 11)) ]; then |
| 224 | ++ echo "slower than the previous release, $(cut -d" " -f1 BOOT), by more than a tenth" |
| 225 | ++ exit 1 |
| 226 | ++fi |
| 227 | +diff --git a/src/fixpoint.sh b/src/fixpoint.sh |
| 228 | +index 5375bc0..8ace35a 100755 |
| 229 | +--- a/src/fixpoint.sh |
| 230 | ++++ b/src/fixpoint.sh |
| 231 | +@@ -1,19 +1,20 @@ |
| 232 | + #!/bin/sh |
| 233 | +-# The fixpoint: the seed builds src/ (stage 1), that builds src/ |
| 234 | +-# (stage 2), that builds it again (stage 3), and stages 2 and 3 must |
| 235 | +-# be the same file. A program holds the paths it was made from, so each |
| 236 | ++# The fixpoint: the previous release, BOOT's, builds src/ (stage 1), |
| 237 | ++# that builds src/ (stage 2), that builds it again (stage 3), and |
| 238 | ++# stages 2 and 3 must be the same file. A program holds the paths it was made from, so each |
| 239 | + # stage is built by the same command in the same place, from the |
| 240 | + # compiler before it copied to build/fix/raz. Run from the repository |
| 241 | + # root, after `make raz`. Then stage 3 stands in for ./raz (messages name |
| 242 | + # the library by its path from the compiler, so it must be at the root) |
| 243 | +-# while `make check` and `make bench` run on it; the seed's comes back. |
| 244 | ++# while `make check` and `make bench` run on it; the one make built |
| 245 | ++# comes back. |
| 246 | + set -e |
| 247 | + d=build/fix |
| 248 | + rm -rf $d |
| 249 | + mkdir -p $d/v |
| 250 | + ln -s ../../lib $d/lib |
| 251 | + printf 'module Version;\nconst Text* = "%s";\nend Version.\n' "$(tr -d "'" < build/version.inc)" >$d/v/Version.raz |
| 252 | +-cp build/seed/raz $d/stage0 |
| 253 | ++cp build/boot/raz $d/stage0 |
| 254 | + for n in 1 2 3; do |
| 255 | + cp $d/stage$((n - 1)) $d/raz |
| 256 | + $d/raz -Werror -I src -I $d/v -o $d/stage$n src/Raz.raz |
| 257 | +``` |
| 258 | + |
| 259 | +and `src/boot.sh`: |
| 260 | + |
| 261 | +``` |
| 262 | +#!/bin/sh |
| 263 | +# The compiler that builds src/: the release BOOT names, by its tag and |
| 264 | +# its tarball's SHA-256. A release's tarball is the same, byte for byte, |
| 265 | +# wherever it is made (the Makefile's dist), so the sum pins the very |
| 266 | +# compiler; and since that release was built by the one before it, back |
| 267 | +# to v0.19.0, which the Pascal seed built (git has it at that tag), |
| 268 | +# raz can always be built again from source alone. |
| 269 | +# |
| 270 | +# The tarball is taken from build/boot/ if it is there; else from the |
| 271 | +# GitHub release, by curl, or by gh's REST API where the repository is |
| 272 | +# private and gh has a token; a machine with no network has it put |
| 273 | +# there by hand. Its raz goes to build/boot/raz, with this repository's |
| 274 | +# lib/ beside it, since src/ is built against today's library. Run from |
| 275 | +# the repository root, by make. |
| 276 | +set -e |
| 277 | +read tag sum < BOOT |
| 278 | +v=${tag#v} |
| 279 | +t=raz-$v-linux-x86_64.tar.gz |
| 280 | +d=build/boot |
| 281 | +repo=ldiaz94/raz |
| 282 | +mkdir -p $d |
| 283 | +if [ ! -f $d/$t ]; then |
| 284 | + if ! curl -fsSL -o $d/$t https://github.com/$repo/releases/download/$tag/$t 2>/dev/null; then |
| 285 | + id=$(gh api repos/$repo/releases/tags/$tag --jq ".assets[] | select(.name == \"$t\") | .id" 2>/dev/null) && |
| 286 | + [ -n "$id" ] && |
| 287 | + gh api -H 'Accept: application/octet-stream' repos/$repo/releases/assets/$id >$d/$t 2>/dev/null || |
| 288 | + { rm -f $d/$t; echo "boot: can't fetch $t; put it in $d" >&2; exit 1; } |
| 289 | + fi |
| 290 | +fi |
| 291 | +if ! echo "$sum $d/$t" | sha256sum -c --quiet - >/dev/null 2>&1; then |
| 292 | + echo "boot: $d/$t isn't $tag's tarball: its SHA-256 isn't BOOT's" >&2 |
| 293 | + exit 1 |
| 294 | +fi |
| 295 | +rm -rf $d/raz-$v-linux-x86_64 |
| 296 | +tar -xzf $d/$t -C $d |
| 297 | +cp $d/raz-$v-linux-x86_64/raz $d/raz |
| 298 | +ln -sfn ../../lib $d/lib |
| 299 | +``` |