boot2

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

commit 9ecdd23fb47bc80e80f39af4bcb55069c2f59760
parent 62dabed96093fc078dc4098443bb6b59887cc5ad
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Mon, 27 Apr 2026 19:56:55 -0700

scheme1: bump HEAP_CAP_BYTES 64 -> 256 MiB, p_memsz 128 -> 512 MB

Lex+pp on the full 608 KB tcc.flat.c needs ~170 MB at end of lex and
more during pp; the previous 64 MiB heap and 128 MiB p_memsz were
both exhausted before lex finished. Bumping in two doublings (64 ->
128 -> 256 MiB heap, 128 -> 256 -> 512 MB p_memsz) so the headroom
is comfortable enough to drive the rest of the tcc.flat.c blockers
into view. Lex now completes on the full file at ~170 MB; pp still
exceeds the cap and is the next target for streaming work (see
docs/CC-STREAM.md).

scheme1/scheme1.P1pp:46  HEAP_CAP_BYTES 0x4000000 -> 0x10000000
vendor/seed/<arch>/ELF.hex2  p_memsz 128 MB -> 512 MB

All three arch ELF.hex2 files updated identically.

Diffstat:
Mscheme1/scheme1.P1pp | 6+++---
Mvendor/seed/aarch64/ELF.hex2 | 2+-
Mvendor/seed/amd64/ELF.hex2 | 2+-
Mvendor/seed/riscv64/ELF.hex2 | 2+-
4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/scheme1/scheme1.P1pp b/scheme1/scheme1.P1pp @@ -34,8 +34,8 @@ # BSS arenas anchored past :ELF_end. readbuf is 1 MiB (sized to fit # the catm'd cc compiler source incl. prelude — see READBUF_CAP_BYTES), # then symtab, then the heap last so it can use the full remainder of -# the ELF p_memsz reservation (currently 128 MiB) declared in -# vendor/seed/<arch>/ELF.hex2. HEAP_CAP_BYTES (currently 64 MiB) is +# the ELF p_memsz reservation (currently 512 MiB) declared in +# vendor/seed/<arch>/ELF.hex2. HEAP_CAP_BYTES (currently 256 MiB) is # the explicit cap; total bss usage = readbuf + symtab + heap and must # fit inside p_memsz. p1_main calls libp1pp's init_arenas, which walks # arena_table and writes &ELF_end + sum of prior sizes into each @@ -43,7 +43,7 @@ %macro SYMTAB_CAP_SLOTS() 8192 %endm %macro READBUF_CAP_BYTES() 1048576 %endm -%macro HEAP_CAP_BYTES() 0x4000000 %endm +%macro HEAP_CAP_BYTES() 0x10000000 %endm # ========================================================================= # Tag idioms diff --git a/vendor/seed/aarch64/ELF.hex2 b/vendor/seed/aarch64/ELF.hex2 @@ -62,7 +62,7 @@ B7 00 # e_machine Indicating AArch64 &ELF_base 00 00 00 00 # ph_physaddr %ELF_end>ELF_base 00 00 00 00 # ph_filesz -00 00 00 08 00 00 00 00 # ph_memsz = 128 MB (boot2: BSS past ELF_end; sized for scheme1's 64 MiB heap) +00 00 00 20 00 00 00 00 # ph_memsz = 512 MB (boot2: BSS past ELF_end; sized for scheme1's 256 MiB heap) 01 00 00 00 00 00 00 00 # ph_align diff --git a/vendor/seed/amd64/ELF.hex2 b/vendor/seed/amd64/ELF.hex2 @@ -61,7 +61,7 @@ &ELF_base 00 00 00 00 ## p_physaddr %ELF_end>ELF_base 00 00 00 00 ## p_filesz -00 00 00 08 00 00 00 00 ## p_memsz = 128 MB (boot2: BSS past ELF_end; sized for scheme1's 64 MiB heap) +00 00 00 20 00 00 00 00 ## p_memsz = 512 MB (boot2: BSS past ELF_end; sized for scheme1's 256 MiB heap) 01 00 00 00 00 00 00 00 ## Required alignment diff --git a/vendor/seed/riscv64/ELF.hex2 b/vendor/seed/riscv64/ELF.hex2 @@ -61,7 +61,7 @@ F3 00 ## e_machine Indicating RISC-V &ELF_base 00 00 00 00 ## p_physaddr %ELF_end>ELF_base 00 00 00 00 ## p_filesz -00 00 00 08 00 00 00 00 ## p_memsz = 128 MB (boot2: BSS past ELF_end; sized for scheme1's 64 MiB heap) +00 00 00 20 00 00 00 00 ## p_memsz = 512 MB (boot2: BSS past ELF_end; sized for scheme1's 256 MiB heap) 01 00 00 00 00 00 00 00 ## Required alignment