1
2
3
4
5
6
7
8
9
10
11
12
13
|
# 45 — no prefix pointers, a fast path for constant-size allocation, maps that fit, a makefile
**prefix pointer types are gone.** `*int` as a type is an error now; `int*` is the only form, and a star in front of an expression is only a dereference. the parser lost its prefix branch in `ptype1`, `tstart`, `caststart`, `new(...)` and the parameter detection, casts learned `(int*)x` and `(node**)x`, and every source (src, lib, lsp, tools, bench, examples, tests) was converted by a script and checked by the suite. a pointer to an array or a function type is spelled through a `type` alias.
**allocator primitives.** a `new` with a constant size computes its size class at compile time and calls `new_k`. a typed `new` of a pointer-free struct is freed with `recycle_leaf`, which re-checks type and class at run time. the hold test in `new_k` is "does this block overlap the held range" rather than "is there a held range", because the default map always has one (the compiler's type area) and the blanket test sent every call down the slow path. `tests/allocfast.zc` covers zeroing, the owner case and the live count.
**maps that fit.** `genmap --grow` and `tools/automap.sh` size a map to the program. the run-only images stopped fitting the fixed 36864-word map once the runtime grew; now each is laid out for its own length. `baremetal/run.sh` had stale paths from before the reorganisation and was fixed on the way.
**makefile, and no binaries in the tree.** `make` builds into `bin/`; `bin/`, `build/` and `web/zc.wasm` are ignored. the task list file was removed once everything on it was done.
**formatted and commented.** `src/rt.zc`, `src/compiler.zc` and `lsp/server.zc` were rewritten to one layout (one statement per line, a body of more than one simple statement opened out, short single-statement ifs kept on one line), checked by confirming the genome came out byte for byte the same. then the two core files got a pass of explanation: an overview at the top of each saying how the pieces fit, a note before every function that was not self-evident, and the analyzer's model of a local (what each state means) written down once where the locals are declared. the whole pass was comment-only, so the genome is still identical. one thing to know when writing comments in zc: a backtick ends the source even inside a comment, so none can appear in these files.
fixpoint 125702 words. suite 440 passed, 0 failed here.
|