boot: structs by value (System V), addr(fn) callbacks -- the compiler builds itself

C structs travel as C passes them: up to 16 bytes in INTEGER/SSE registers per eightbyte,
bigger ones byval and through sret, out-of-registers structs on the stack. addr(fn) makes a
C-callable thunk that rebuilds the arguments. With those, the self-hosted compiler can
compile boot/cimport.fch, which calls libclang with CXCursor and CXString by value and gives
it callbacks -- so it compiles itself.

boot.sh: stage 2 and stage 3 are identical (57904 lines of IR); 22 passed, 0 failed,
0 skipped. Only x86-64 System V so far; Windows and ARM64 conventions are still in C++.
This commit is contained in:
Nexoniarz 2026-10-25 19:47:20 +01:00
commit 04d5486477
2 changed files with 337 additions and 41 deletions

View file

@ -32,10 +32,6 @@ for f in tests/run/*.fch; do
# (checked in the test and in the modules it imports)
files="$f"
for m in $(sed -n 's/^import \([a-z_]*\)$/\1/p' "$f"); do files="$files tests/run/$m.fch"; done
if grep -qE '"abi.h"' $files; then
skipped=$((skipped + 1))
continue
fi
input="${f%.fch}.in"
[ -f "$input" ] || input=/dev/null
if ! "$boot" build "$f" -o "$tmp/prog" > "$tmp/err" 2>&1; then