raz: the plan to 1.0 #
What is left before raz is 1.0, in order, by the owner's word of 2026-10-23. raz takes no proposals; what is left is the Moss work below, its proposals kept in the appendix, and nothing else is planned. Each step is a release, started on the owner's go-ahead; within it, one commit per piece, the report first for any change to the language.
1. Release what is done: v0.22.0 #
Done 2026-10-23: tagged, its release and tarball made here by make dist (CI was refused by GitHub's billing), and BOOT moved to it.
make alpine couldn't pull its image without a Docker Hub login.
Report 2026-10.36, the twelfth thaw: MIN, MAX, ABS, CLZ, CTZ,
POPCOUNT, INT(b), OFFSET, SIZE(T.f), BYTES, FILL, a qualified
case in an arm, slice and ERROR constants, a record's procedure field
that takes the record; the library's growth since v0.21.0 (Fmt, Str,
Files, Sys, Math, Opt, Heap.sure, Vec, Arena); inlining a
procedure that only returns, and COPY, FILL and array parameters made
fast.
- Check:
make check,make fixpoint,make bench,make prev-bench,make kernels,make alpine, the report's pages (35 at 10.36). - Tag
v0.22.0; then, as a step of its own, moveBOOTto it, so thatsrc/and the library it imports may use what 10.36 brought.
2. The safety thaw: v0.23.0, then v0.24.0 #
The scope, by the owner's word of 2026-10-26, after reviewing
MEM_PROPOSAL.md (in git to 2026-10-26) whole with its appendices.
raz doesn't promise memory safety: free stays, so a program can
always keep a pointer to what it freed. The thaw shrinks what is
undefined, and fences what can reach memory it shouldn't, so a reader
can find it.
What goes in:
- An array a call returns lives to the end of its procedure ("Less that is undefined", piece 1; the proposal's F.1). Its slot is reserved as a deferred statement's is.
- A race tears no slice, said: 7.6 says a slice or variant read and written in a race is undefined (piece 3). Said, not prevented: no 16-byte moves.
[]const T, a slice whose elements can't be written; a[]Tgoes where one is wanted, never back. String literals are[]const U8, and a constant's slices[]const T, so writing them is an error (piece 2 drops out).Str.trim,cutandfieldtake and return[]const U8. "Left out"'s exported array read as a slice comes with it.- The fence, Oberon's way: the unsafe operations are reached
through a pseudo-module,
import SYSTEM.SYSTEM.ADR,SYSTEM.PTR,SYSTEM.SYSCALL,SYSTEM.ARGV; pointer indexing, slicing and arithmetic, conversions to and from pointer and procedure types, views whose type holds a pointer, procedure or slice,extern,link, code procedures andcheck offare allowed only in a module that imports it. A warning for one release, so thatsrc/can come to it onceBOOTknows it, then an error. CAS,XCHGandXADDtake a variable, asINCdoes, not an address (the proposal's E.4), so atomics need noSYSTEM.- Library:
Heap's debugging mode (G: freed blocks poisoned and held back, guard bytes checked);Task(T), a thread started with no cast;Lock.Guarded(T), a value with its lock.
What is left out, and why: ret and keep (B) and owners that count
what they lend (C), too large for what they close without the rest;
the heap without free (D), since free stays; atomic slices and the
rest of threads (E), for programs that race only. With them the
guarantee of the proposal's section 3.
The survey of 2026-10-26 (the compiler counting each use, across
~/r): about 8,000 fenced uses, 451 of 960 modules. 77% of the ADRs
go to a pointer parameter only dereferenced, mended by var or
const, as STANDARDS.md asks; what is left for SYSTEM is about
3,000 uses, most in lib/ (Sys, Rt, Heap, Map) and src/
(Scan, Link, Chunk). All 31 atomics take ADR.
Two releases, by the owner's word of 2026-10-26, since src/ and the
library it imports (Buf, Files, Fmt, Heap, Mem, Out, Rt,
Str, Sys, and Lock and Bytes under them) must build with
BOOT, which knows neither []const nor SYSTEM:
- The report's text, for the owner to review (drafted 2026-10-26).
- v0.23.0, which breaks nothing. The compiler, a commit a piece,
each with its part of the report: an array a call returns kept to
the end of its procedure; atomics on a variable;
[]const T;SYSTEM. The old forms are still taken, silently: a string literal into a[]U8,ADRand the rest withoutSYSTEM, an atomic given a pointer. The library:Task,Guarded,Heap's debugging mode. Release, and the report's pages checked. Done 2026-10-26: tagged, released here bymake dist(CI refused by GitHub's billing, as for v0.22.0), its SHA-256103eb421...; the website has v0.22.0 and v0.23.0; 35 pages. No rewriting tool, by the owner's word: v0.24.0's errors point at each place to mend. BOOTmoved to v0.23.0, a step of its own. Done 2026-10-26.- v0.24.0, which enforces it. Steps 1 to 3 done 2026-10-26:
raz -strictfirst,lib/,src/, the tools and tests mended against it by agents, then the old forms made errors and the option gone. Released 2026-10-26 as v0.24.0; the programs in~/rfollow, the owner's five first (dwa, concha, mosaico, rat, notis).lib/,src/,tools/,examples/and the tests mended where the old forms, made errors, are found (ADRat a parameter only dereferenced becomesvarorconst;SYSTEM.where an address is kept); the programs in~/rmended the same way, by agents, each its own commit. Release.
3. The Moss work: v0.25.0 #
The scope, by the owner's word of 2026-10-26: what makes raz a better
freestanding and portable compiler, nothing for Moss alone. Host is
in. -moss (the branch moss-startup-args-v1) is not: Moss supplies
its own start under item 4's contract, so raz knows no system's calls
but Linux's. Of the implementation limits, the report's least and this
compiler's errors past its own are in; compiling imports from the
leaves and queuing instances, so the compiler fits a small stack, are
dropped for good: Moss gives the compiler a larger stack instead.
Report 2026-10.38 (993cd63) holds the language's part.
- Merge the branch
moss-platform-boundary's two plain fixes (a file's identity fromSys.info; a main file at the root), rebased on main. Host, as "The compiler on another host" in the appendix asks: five procedures,Files.argCount, a host chosen by staging, its tests insh, not Python; rebased and merged. Moss'sRAZ_PORT.lockthen pins main.- What the compiler asks of
Sys,RtandFiles, written down indoc/compiler.mdand held by a test. - "A freestanding program, stated", "The assembler's instructions" and "Implementation limits, and a compiler for a small stack" (the report's least and the errors only), in the appendix.
- Release. Done 2026-10-26: v0.25.0, report 2026-10.38.
4. The hard freeze #
From v0.25.0 on: no more thaws. The language changes only to mend a defect; the library's core (appendix A) only to mend a defect or plug a very big gap; the rest of the library grows only conservatively, by what breaks no program, on the owner's word.
v0.25.1, 2026-10-29, the report unchanged, on the owner's word:
Sys.errReadOnly* = -30(EROFS), besideerrNoSpaceinlib/Sys.razandlib/Sys.linux-x86_64.raz, and indoc/raz-lib.md's list. It is the standard library's part ofSys, not the core, and a new name breaks no program. Done. arkusz'sAsheetionames it for itself (ReadOnlyFs) and may now takeSys.errReadOnly.raz -q checkandraz -q words, for an editor's language server (raz-lsp,~/r/raz-lsp): the compiler, not the language. Done.
v0.25.2, 2026-10-29, the report unchanged: raz -q def, where the name
at the cursor is declared, for raz-lsp's hover and go to definition.
v0.25.3, 2026-10-29: raz -q def on a module, used or imported, gives
its module line.
5. arm64 macOS: v0.26.0 #
Started by the owner's word of 2026-11-15: raz on an Apple Silicon Mac,
natively, as a second target, darwin-arm64. Report 2026-11.0 names
it and changes no language (section 3, appendix A).
The shape. Gen is the only unit that knows the machine, and
Exe (Exe.linux.raz, once Elf) the only one that knows the executable, so the port is new
units beside them, not a change to Parse or Item:
A64.raz, besideX64.raz: arm64's instructions encoded, branches within a procedure, and the assembler for code procedures (Arm's syntax, the instructions the library's code procedures use;dbfor any other).Gen.arm64.raz, besideGen.x86_64.raz: the same calls, the stack machine kept in arm64's registers; Apple's calling convention (x18 never touched, a frame record in x29, the arguments past a variadic C procedure's own on the stack); every address byadrpandadd, since macOS runs no executable at a fixed address; the atomics by the LSE instructions every Apple processor has. Two things x86 does for free and arm64 doesn't, which the report binds: a division by zero, or the smallest value by -1, stops the program (arm64'ssdivgives 0), so it is checked; a real out of anI64's range, or a NaN, gives the smallestI64(arm64'sfcvtzssaturates), so it is mended after.Exe.darwin.raz, besideExe.linux.raz: a Mach-O executable for dyld, linked to libSystem, as every macOS program must be; C's symbols bound into a table of quadwords, as GLOB_DAT does now; every address in data rebased, since the program is position-independent; its symbol table for lldb's backtraces; and an ad-hoc code signature, SHA-256 hashes of its pages, without which arm64 macOS won't run it; and line numbers for lldb, as DWARF in__DWARF(below).Host.darwin.raz: the library beside the compiler by_NSGetExecutablePath, C always, a program run from a file written and made executable (nomemfd_create).Link: the places in data that hold an address, listed forExe.darwin.raz's rebasing.
A compiler compiles for the system it runs on, as now: its target is
the one it was built for, its back end and executable chosen at its
build by the target's suffixes (section 3), Gen.arm64.raz and
Host.darwin.raz as Sys.linux-x86_64.raz is today. No -target.
A compiler for one system that runs on another is built by staging,
as appendix (b) proposes for Moss: src/cross.sh copies src/ with
the other target's files in place. It is needed once, for the first
Mac compiler, and wherever a release for one system is made on the
other.
The library. Over libSystem, through lib/Sys.raz, the C one,
with CAbi.darwin-arm64.raz made by tools/cabi.c on the Mac, never
by hand. Rt.darwin-arm64.raz: the signals and their own stack, the
place a fault stopped at from the Mac's ucontext, and framePtr,
liveRegs, here and sigReturn in arm64. Thread.darwin.raz over
pthreads, its Mutex on os_unfair_lock. Bytes.arm64.raz. Math's
sqrt, mul and div128 and Str's code procedure move into
.x86_64 files with arm64 twins: no generic file keeps machine code.
None of it breaks a program.
Steps, one commit each, make check passing first (in a
linux/amd64 container on the Mac until there is a Mac compiler):
-
Report 2026-11.0, for the owner's review. (This commit.)
-
Done. A container to build and check in on the Mac (
make docker-check), the budget raised to 18,000 inCLAUDE.mdanddoc/compiler.md, and the Makefile and scripts made to run on BSD's tools as on GNU's (sed -i,stat,sha256sum). -
Done.
Gen.raztoGen.x86_64.raz,Elf.raztoExe.linux.raz(the unitExe),Host.raztoHost.linux.raz,src/cross.sh: what Linux's compiler makes unchanged, byte for byte. -
Done.
A64.raz: arm64's encoder, jumps within a procedure, and the assembler in Arm's syntax (bl p,b p,adr xN, vfor names), checked against Apple's assembler (clang's,llvm-mc's bytes) bytest/a64; Chunk's arm64 fixup kinds,fxBranch26,fxPage21andfxPageOff12, andScan.setBangfor a pre-index's!. What it left for later,Link's patching of those kinds,Gen.arm64.razimportingA64, and padding withbrk, came with 5a. -
Done.
Gen.arm64.raz, in pieces, each run on the Mac (owner, 2026-11-15): first a bareExe.darwin.raz(a signed Mach-O over libSystem, no line numbers) and anRtthat only exits, built by the staged cross compiler in the container; then values and operations; jumps and checks; calls and frames; reals; atomics, deferred statements, the entry point.5a, done: programs made by the cross compiler (
src/cross.sh darwin-arm64) run on the Mac,test/macbymake mac-check. InGen.arm64.raz: frames, constants, variables, the integer operations but division, comparisons and jumps, elements and slices unchecked, calls with arguments in registers, C's calls, code procedures and the entry point; every other routine notes "not yet on arm64" on its procedure, an error if the program uses it.Exe.darwin.raz: a signed Mach-O over libSystem, its rebases and binds dyld's opcodes, no line numbers.Link: arm64's fixups, Mach-O's paged layout, the rebases.lib/Rt.darwin-arm64.raz: exit through C's exit, one procedure at exit, fail and stop bywrite. As the interface check ofRtreadsRt.raz, and so compilesSysover C, alsolib/CAbi.darwin-arm64.raz, fromtools/cabi.con the Mac, and a code procedure skipped in a file read only for its interface.5b, done: division and its checks (by zero, the smallest by -1, in every width), the checks of indexes, slices, views and enumerations with their stubs for
Rt.fail, arguments past x7 on the stack, results in memory through x8, Apple's variadic calls,try, deferred statements, jump tables,compareSeq, copies past 256 bytes,ABSof an integer; and, sinceOutneeds them, the atomics andCOPY.SYSTEM.SYSCALLis an error on the Mac, Linux's only (report 6.8).lib/Rt.darwin-arm64.razsays what failed with its values, by its address, runs 32 procedures at exit, and tells a nil pointer or procedure and a stack overflow by a handler of SIGSEGV and SIGBUS.make mac-checkruns conform/run too and counts it: 91 of 111 pass, the others needing reals (13),FILL(4,Heap's among them),CLZ,ROL, orSYSCALL(SystemImport, Linux's only). Left of step 5 (5c): the reals,FILL,NEW's zeroing, the counts of bits and the rotations.5c, done: the reals,
F32andF64, on the stack in v16 to v21 and as variables in d8 to d15, which the prologue saves; their operations, comparisons (a NaN equal to nothing), conversions both ways and between widths, a real out of anI64's range or a NaN mended to the smallestI64afterfcvtzs,ABSand-; real arguments in v0 to v7 and on the stack, results in d0; a code procedure that isfsqrtmade in place of its call.FILL,NEW's zeroing,CLZ,CTZ,POPCOUNT(bycntandaddv),ROLandRORat every width. A C procedure's own arguments past x7 packed by their size, as Apple's convention wants. Nothing ofGen.arm64.razis "not yet"; onlySYSCALLis refused, sotest/mac.shskips conform/run'sSystemImport, with the reason. conform/run passes on the Mac, 110 of 110;test/machas the reals' edges (Reals), rotations and counts of every width (Rotate) andfsqrtin place (Sqrt). Left for later steps:Math's arm64 twin, so thatMath.sqrtis made in place (step 7). A rotation of a negativeI8orI16leaves the bits above its width zero, where x86-64'srol al, clleaves them as they were. -
Done.
Exe.darwin.raz's line numbers for lldb, in a__DWARFsegment (mapped, read only: dyld refuses a segment bigger in the file than in memory), the compile unit and its abbreviation made byLinkfor both formats,make lldb; other C libraries (link "X11";is@rpath/libX11.dylib, four rpaths, binds by flat lookup);test/mac/NarrowArgs, a C libraryccbuilds, narrow arguments past x7, a variadic call and a callback;Host.darwin.raz, andHOST=darwin src/cross.sh darwin-arm64, which stages the first Mac compiler: it runs on the Mac, compiles and runs programs, and buildsProcs. -
Done. The library:
CAbi,Sys,Rt,Thread,Bytes,Math,Str. -
test/andconform/passing on the Mac; what differs by target (signals' words, errors' numbers) in files of the target's. -
The first Mac compiler, by the staged cross compiler; it builds itself;
make fixpointon the Mac;make benchat 400,000 lines a second there. -
The release: two tarballs,
linux-x86_64anddarwin-arm64;BOOTnames one for each host, with its sum.
The owner's answers, 2026-11-15:
a. The budget is 18,000 lines of code.
b. The names are darwin-arm64.
c. No CI for now: the Mac's tarball is made here by make dist.
d. The port is v0.26.0; the clean-up and 1.0 move one on.
e. Line numbers for lldb are in v0.26.0 (below).
Line numbers on the Mac. Exe.linux.raz writes DWARF 4 already: the line
table makeLines makes, target-blind, and the one compile unit
putDebug writes. lldb reads DWARF from an executable's __DWARF
segment, as it does Go's, so Exe.darwin.raz writes the same three sections,
__debug_line, __debug_info and __debug_abbrev, there, unloaded,
before __LINKEDIT; make gdb's twin drives lldb --batch. About 50
lines, makeLines and putDebug shared by the two writers.
Where it stands, 2026-11-15, stopped by the owner's word:
- Done and pushed: steps 1 to 7. A cross compiler, built in the
container by
src/cross.sh darwin-arm64, makes Mach-O programs that run on the Mac:make mac-checkpasses test/mac, all of conform/run (SystemImport aside, SYSCALL being Linux's), the library's tests and test/libc (ExecveC aside, /proc being Linux's); lldb stops at a line.HOST=darwin src/cross.sh darwin-arm64stages a native compiler that runs on the Mac. Linux is unchanged:make docker-check, the fixpoint, and x86-64's output byte for byte. - Step 9, half done, unchecked, on the branch
wip-darwin-step9(f87c668, pushed):make razon the Mac throughsrc/bootstrap.sh,BOOTnaming a tarball per host, the fixpoint and bench on the Mac,raz run's temporary file,make distfor the Mac. To resume: check it out, readgit diff main, runmake docker-checkandmake mac-check, finish what's missing, merge. - Not started: step 8 (
make checknatively on the Mac,test/'s expectations per target where the Mac differs) and step 10 (the release). - Known limits on the Mac: a frame of at most 16 MB
(test/run/ThreadOverflowC doesn't compile);
Thread.Mutexisos_unfair_lock, unlocked by the thread that locked it;Bytesis plain raz, no NEON;raz runleaves its file in$TMPDIR(fixed on the branch). The compiler is about 16,700 lines of code of 18,000.
6. Clean-up: v0.27.0, the last before 1.0 #
The files that served the thaws are made a record, short and true:
PROPOSALS.mdandMEM_PROPOSAL.md: gone, done early (2026-10-26); what was built is in the report,doc/report-history.mdand git.~/r/RAZ-GAPS.mdand each repository'sRAZ-NOTES.md(orRAZ.md): closed, each saying so at its top; a gap since mended is marked.CLAUDE.md(raz's and~/r's): "Where things stand" cut to the present; the readings of the report checked one by one against the compiler and the report, and folded into the report where they are the language's, not this compiler's.doc/compiler.md's table and routine names,README.md,doc/raz-lib.mdand the man pages checked against the code;STANDARDS.mdagainst the library.- The programs in
~/rthat pin an older raz (rmacs, ravite, rnet, ...) moved to the release.
7. 1.0 #
No date. raz is 1.0 when use shows it: programs written against v0.27.0 for long enough that no defect is outstanding. Until then it is 0.27.x, mending defects only.
Appendix: the Moss work, as proposed #
The four proposals 3 builds, kept from PROPOSALS.md (in git to
2026-10-26) when it and MEM_PROPOSAL.md went: what the thaws built is
in the report, doc/report-history.md and git.
The compiler on another host: Host, and what it asks of the library #
Status. Built on the branch moss-platform-boundary (3eded0c),
which Moss pins: there raz compiles programs, rebuilds itself byte for
byte, and builds again after a restart (moss c606069,
docs/native-raz.md). Waiting for the owner's word on the questions
below before it is rebased and merged.
The host is the system the compiler runs on; the target, the system
its program will run on. Until the branch they were one, Linux, and
the compiler reached Linux outside Sys: Parse.identity read a
struct stat by SYSCALL(4) into a guessed [18]INT; Raz read
ARGC() and ARGV(), found the library through /proc/self/exe,
probed two loader paths for musl, and ran a program by memfd_create
and execve; Elf set mode 755. The branch does three things.
1. A file's identity from Sys.info (2644329). Its dev and
ino, so the parser makes no system call of its own. A plain fix:
merge it.
2. A main file at the root, and a directory ending in /
(3eded0c). /Main.raz has / as its directory, not "", and a
directory given as lib/ doesn't make lib//Sys.raz. A plain fix:
merge it.
3. Host, a module of what the compiler asks of its host
(bb03e48): argCount, arg, libraryDir, preferMusl, canRun,
canLinkC, writeExecutable, prepareRun, execute. src/Host.raz
is Linux's; Moss stages the compiler's sources with its own
Host.raz (27 lines: the library at /lib, no run, no C, no mode
bits) and its own Sys, Rt and Files.
Questions before the merge:
a. A smaller Host. Two of its nine procedures are there only
because Raz reads the command line by built-ins:
argCountandarggo if the library has the count besideFiles.arg: aFiles.argCount(), which Moss'sFilesgives fromSys.argc.Files.argis already the library's, and Moss already replaces it.preferMuslandcanLinkCare one question, which C library to link against:Host.cLibrary(): CLibwithCLib = (none, glibc, musl), or keep the two booleans.canRungoes ifprepareRunis called while the command line is read, before any source, so that its error is the refusal. That leaveslibraryDir,cLibrary,writeExecutable,prepareRunandexecute: five procedures, each a real difference between hosts.
b. How a host is chosen. The branch stages: copy src/, put the
host's Host.raz in place of raz's, build. The main directory is
searched first, so -I alone can't replace it, which is right: a
module isn't silently replaced. The other way is a target name, as
Sys.linux-x86_64.raz is chosen today from fixed suffixes: a
-os moss that makes the suffixes .moss-x86_64, .moss, .x86_64,
"", so that Host.moss.raz and Sys.moss.raz are found beside the
generic files. That puts Moss's files in raz's tree, and raz would
then know of Moss. The proposal is to keep staging, raz knowing
nothing of any host but Linux, and to document it in
doc/compiler.md as the one way to build for another host.
c. What the compiler asks of the library, written down. Moss's
Sys has 23 exported procedures against Linux's 104, and is enough.
doc/compiler.md should list what the compiler and the modules it
imports (Rt, Mem, Heap, Lock, Arena, Out, Fmt, Buf,
Str, Bytes, Files) use of Sys, Rt and Files, as Moss's
docs/raz-port.md measured it, and a test should hold it: the
compiler built against a Sys with only those exports. Then a change
to the compiler that reaches for one more of Sys is seen in raz,
not in Moss's next build. The test host on the branch
(test/host/Host.raz) checks the Host side only.
d. The stack. A self-build passed in 64 KiB of stack on Linux, but 64 nested parentheses don't, and Moss gives a stored program 1 MiB. That is "Implementation limits, and a compiler for a small stack", above; the merge needn't wait for it.
e. The tests in Python. The branch adds test/compiler-host.py
(177 lines) and grows test/library-path.py, which came with
RAZ_PATH. raz's tests are otherwise sh, as a public project's
should be, needing nothing but a shell to run. The proposal is to
write both in sh before the merge.
f. Before the merge, in any case. The system call numbers in
Host.raz named as constants, as Raz had them (MemfdCreate,
MfdCloexec, Execve); a comment on every procedure; the new section
of doc/compiler.md made as short and plain as the rest; a rebase on
main (doc/compiler.md and src/Raz.raz conflict). Moss's
RAZ_PORT.lock then pins a commit on main.
A freestanding program, stated #
Status. Proposed 2026-10-22, collated from RAZ-GAPS.md.
"For a kernel: three changes to the compiler" made a raz program run on
the bare machine; Moss, a kernel in raz, now boots on it. What it found
is less a missing feature than missing words: what a -bare program
must give the compiler, and what it may count on, are known only by
reading Gen.entryPoint and Raz. Five items, each standing alone.
The sixth thing Moss met, jmp rax read as a jump to a label, was a
bug, fixed in ac3c464.
1. The runtime ABI, written down. A section of doc/compiler.md,
"A program with its own Rt", saying what the compiler asks of Rt
and what a program's start may count on:
- Required:
proc exit*(status: INT);, which never returns (the compiler putsud2after its call), andproc fail*(what, a, b, len: INT; at: UINT; name: ^U8; rdi, rsi: UINT);, with the kinds ofwhataslib/Rt.razgives them (0 an index, 1 a slice, 2 an enumeration, 3 a backward slice of a pointer, 4 a nil pointer, 5 a division by zero, 6 a stack overflow, 7 a view), named constants in the text, not bare numbers. - Optional, found by name when declared:
places,calls,teller,place,placer(item 5),startProfileandprofiler(never under-bare),cExit(only with C, which-barerefuses). - The entry:
_startruns every used module's body butRt's, thenmain. Under-bareit reads nothing from the stack and aligns nothing: the loader or boot stub enters it with the bss zeroed andrspa multiple of 16, as Linux does. mainreturning: allowed.Rt.exitis then called withmain's result, or 0 forproc main*.- The panic hook:
Rt.failis it. A kernel'sfailprints and halts; nothing else is needed, and no second hook is proposed.
A test holds it: test/run/ builds a -bare program against a
smallest Rt of exit and fail alone, run under Linux, whose
exit and fail make the system call themselves.
Met in Moss (docs/raz-findings.md §2), which copied the stock
signatures.
Recommendation: take; it is words and one test, and the contract already exists.
2. A recipe for an interrupt's entry. Before any attribute or
generated stub, a tested recipe in doc/compiler.md, beside item 1,
stating what the compiler's code may assume and so what a stub must
restore:
- What the compiler's code uses: System V's caller-saved
registers,
rax,rcx,rdx,rsi,rdi,r8tor11, all ofxmm0toxmm15, and the flags; the direction flag is clear at every call (the compiler's copies usestdandcldand leave it clear). - The red zone: whether the compiler ever writes below
rsp. Not checked today ("For a kernel" leaves it open); it is to be checked and the answer written down. If it never does, an interrupt needs no IST stack for that reason. - The stub: a
codeprocedure per vector that pushes 0 where the CPU pushes no error code, pushes the vector, saves the caller-saved registers, alignsrspto 16, saves the SSE state (fxsaveorxsaveto an aligned area),cld, calls an ordinary procedureproc handle(vector, code: INT; frame: ^Frame), restores, drops the two words andiretq.
It is testable on Linux: iretq from ring 3 to ring 3 is allowed, so
test/run/Interrupt.raz builds a frame by hand, jumps to the stub, has
the handler compute with reals, and checks on return that every
register the stub promised to keep is kept. The stub needs items 3 and
"The assembler's instructions", 1 (push of a constant, cld).
Met in Moss (docs/raz-findings.md §4): its handlers use only rax
and make no call, which is safe but no recipe.
Recommendation: take; a kernel's first stub is where the calling convention is easiest to get wrong, and a test on Linux keeps it right.
3. A code procedure names a procedure or a global. In a code procedure, a name of the module's scope, or a qualified one, that is a procedure or a global variable stands for its address, as an operand of three forms only:
call fault; (* a procedure, rip-relative *)
jmp fault;
lea rax, [ticks]; (* a procedure or a global *)
Each makes a reference to that chunk, so the linker keeps what is
named, as any call does. No other operand takes a name, and no type is
checked: a code procedure is the target's, and its author already
answers for the convention. The assembler gets the names as it gets
constants, by a function the parser hands in beside ConstFn.
Moss stores UINT(fault) in a slot at start and calls through a
register (docs/raz-findings.md §5), so the slot must be filled
before the first fault, which nothing checks.
Recommendation: take; three operand forms remove a hand-off that
can be forgotten, and the recipe in item 2 needs call handle.
4. A program brings its own Rt. A src/Rt.raz beside the main
module meets lib/Rt.raz, and "a program has one module of each name"
refuses it, rightly. Moss copies the compiler beside an empty lib/.
Two ways out:
- Staging, as "The compiler on another host" proposes for the
compiler's own sources: copy
razbeside a library of the program's own. Nothing in raz changes; only words indoc/compiler.md. Every freestanding project then carries a copied compiler, and its library is all or nothing. raz -lib DIR: the library isDIR, not the one beside the compiler. A kernel's-libis a directory holding its ownRtandSysand, by symbolic links, whichever of raz's modules it takes (Str,Fmt,Buf). The duplicate check stays as it is. On theHostbranch it is one line overHost.libraryDir; today a few lines inRaz.razand raz(1).
The option is the smaller for its users and nearly as small in raz;
staging stays the way for the compiler on another host, where the
whole of src/ is replaced anyway.
Recommendation: take -lib; a few lines save every freestanding
program a copy of the compiler.
5. Symbols without Rt's places. Without -s the compiler links
places, calls, teller, place and placer and stops with "Rt
has no places" where Rt lacks one, and -noprofile doesn't help, so
Moss builds with -s and loses the symbol table a debugger reads.
Two things are tied that needn't be: the ELF's symbols and lines, for
a debugger, and the places, for Rt to say where a check failed.
The change: each of the five is linked only when Rt declares it,
calls with teller and place with placer, a pair or neither; -s
still strips both. A kernel then keeps its symbols for GDB and gives
fail the raw address, or declares places and decodes them itself.
A hosted program's Rt is raz's, which declares all five, so no
program changes. One that writes its own Rt and misspells places
loses its places silently; item 1 lists the names.
Met in Moss (docs/raz-findings.md §3).
Recommendation: take; it is a test on each name in Raz.raz and
gives a kernel its symbols back.
The assembler's instructions #
Status. Proposed 2026-10-22, collated from RAZ-GAPS.md.
The report leaves which instructions the assembler knows to the
implementation, and db gives any other. That stays. What is missing
is a rule for when an instruction joins, and the few that programs
have already written in db.
1. push of a constant, and cld and std. push imm8 and
push imm32 (6A, 68, sign-extended to 64 bits), and cld and std
in Plain. The encoder already writes cld and std for the
compiler's copies; only the assembler's table lacks them. Moss's
exception stubs write all three with db, and every stub of
"A freestanding program, stated", 2, needs them.
Recommendation: take; three entries the encoder half has, and an interrupt stub can't be written without them.
2. When an instruction joins, and the SHA and shuffle ones now.
The rule, in doc/compiler.md beside the assembler: an instruction
joins when a program writes it in db, it is a family's member the
tables already hold (a code in PackedOps, an entry in Plain), and
its bytes are checked against GNU as in test/run/, as
AsmKernel.raz does. Anything else stays db, which is the permanent
answer for an instruction no program uses twice. By that rule, now:
paddd,punpcklqdq,punpckhqdqintoPackedOps(66 0F FE, 6C, 6D);pshufb(66 0F 38 00) andpalignr(66 0F 3A 0F, with a byte), two more forms, three-byte opcodes;sha256rnds2(0F 38 CB,xmm0implied),sha256msg1(0F 38 CC),sha256msg2(0F 38 CD).
Sauce's SHA-NI hash is 123 db lines assembled by GNU as, nothing
checking a byte against its mnemonic; with these it is read as written.
AES-NI, pclmulqdq, AVX and the rest wait for a program. (movd and
movq, pxor, pshufd, movdqu, movdqa, pmovmskb are there
already.)
Recommendation: take; a rule stops the list growing by wish, and eight instructions turn sauce's 123 unchecked lines into checked ones.
3. raz -S's listing, stated. raz(1) gives the listing's form, so
a tool may read it:
- a blank line, then a procedure's name as
Module.name:; - a source line: its number right-aligned in 6 columns, two spaces, the line's text;
- an instruction: its offset in the procedure right-aligned in 14 columns, two spaces, the instruction as the assembler would read it, a jump within the procedure giving its target as an offset.
Only the main module's live procedures, in the order they were made;
nothing is disassembled. A change to the form is then a change to the
manual, and rcrypto's constant-time guard (tools/branches.sh), which
counts conditional jumps by reading these three kinds of line, breaks
loudly instead of silently. A test in raz holds the form against a
small program's listing.
Recommendation: take; it is a paragraph of raz(1) and one test, for a form that already doesn't change.
Implementation limits, and a compiler for a small stack #
Status. To investigate; nothing decided.
The report names no implementation limits: how deep expressions, statements, imports and generic instances may nest, how long a name or a string may be. A compiler for a small machine that rejects a deep nesting is then arguably not a raz compiler at all. C settles it with its translation limits (C99 §5.2.4.1: 63 levels of nested parentheses, 15 of nested includes, and so on): every compiler must take at least that much, and may take more. The proposal: a short section in the report giving the least each compiler must accept, and saying that a compiler that goes past its own limit stops with an error naming it, never a crash. It changes the report, not the language.
Behind it, three things in this compiler that need no change to the report at all, so that it runs in a small stack:
- Nesting. Each level of a nested expression costs about 1 KiB of stack. A constant expression with 64 nested parentheses fails a 64 KiB stack and passes 256 KiB; 256 of them fail 256 KiB and pass 1 MiB. A limit from the section above, checked in the parser, makes the stack a program needs bounded and known.
- Imports.
importModulecompiles an imported module in the middle of the one importing it, on the same stack, so the stack grows with the depth of the chain of imports. Ordering the modules first and compiling them from the leaves, in a loop, keeps whole program compilation and a stack that doesn't grow; symbol files, as Wirth's compilers have, would do it too, but must then carry a generic module's body. - Instances.
makeInstancekeeps the declaration under way aside in arrays on the stack ([MaxFwd]PType,[MaxFwd]Diag.Pos,[MaxNames]INT, several KiB) for every instance it nests. A list of instances still to make, made between declarations, would keep none.
Not yet measured: which of these filled the stack when the stripped
compiler, given one more -I directory, overflowed 64 KiB building
itself, where the ordinary self-build fit.
Met in moss (docs/raz-port.md): its stored programs get a guarded
64 KiB stack, and a native compiler must fit, or the stack must grow
(2026-10-22).