boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs

commit 2eb0c7d9d788f25032944b92823867115b2402d7
parent 992c8cc15c1e7ae225711195b82fbadcf384327a
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Thu, 23 Apr 2026 14:30:07 -0700

post updates

Diffstat:
Mpost.md | 18++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/post.md b/post.md @@ -140,8 +140,8 @@ enough of a C compiler in Scheme to compile the tcc source. m1pp is a small macro expander layered on top of M0, with an aim of making it bearable enough to write assembly programs that you might just want to linger for a moment way down here near the bottom of the sea. It adds three things M0 -doesn't have: user-defined macros with named parameters, integer expressions -that evaluate at expand time, and conditional expansion. +doesn't have: macros with named parameters, integer expressions that evaluate +at expand time, and conditional expansion. Features: @@ -203,8 +203,9 @@ Registers: - `sp` — stack pointer. That's a modest budget — twelve visible registers. The goal is small backends -and uniform source across a 32-bit RISC-V, an aarch64, and an x86-64. Anything beyond this that a backend needs for encoding (scratch regs, -link register, zero register) is backend-private and exposed only through the +and uniform source across a 32-bit RISC-V, an aarch64, and an x86-64. Anything +beyond this that a backend needs for encoding (scratch regs, link register, +zero register) is backend-private and exposed only through the portable ops. `LA_BR` is the one exception on the source side: it loads a label into a hidden *branch-target register* that the immediately following direct control-flow op (`B`, `CALL`, `TAIL`, or any conditional branch) then @@ -235,9 +236,6 @@ Ops: hard-coding the frame layout. - System: `SYSCALL`. -No floating point. P1 is a scalar-integer world; enough for a Scheme and a -C compiler. - Calling convention: - `a0`-`a3` hold the first four argument words; extras live in an incoming @@ -262,9 +260,9 @@ P1 ships as a pair of files you catm before any P1 source: Concrete sizes for what's landed today: -- `m1pp.M1`: ~2.5 KLOC — the M1 source of the macro expander itself. -- `P1.M1pp`: 224 LOC — the portable P1 interface. -- `P1-aarch64.M1pp`: ~500 LOC — one arch backend. +- `m1pp.M1`: XX KLOC — the M1 source of the macro expander itself. +- `P1.M1pp`: ~150 LOC — the portable P1 interface. +- `P1-aarch64.M1pp`: ~460 LOC — one arch backend. The pitch of this rewrite — shrinking the pre-Scheme KLOC count — can't be fully cashed in until scheme.P1 and cc.scm land; that's where the 30KLOC of