Commit d1aabc72
d1aabc72595bMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 6 files · ~5 modified · -1 deleted
Description
Fold the driver into spinelc: one self-contained binary (no shell)
The spinel POSIX shell script is gone; spinelc is now the whole compiler
AND driver in a single native binary. It parses, infers types, emits C,
invokes cc to link against libspinel_rt.a, and (with -E) runs the result.
No shell wrapper and no chained helper binaries, so the compiler works on
Windows natively.
main.c grows the full driver: all flags the shell handled (-o/-c/-S/-E, -e, -O/-g/--debug, --line-map/--no-line-map, --cc, --int-overflow, --rbs, --emit-rbs/--emit-types/--emit-symbol-map), self-locates lib/ from the executable path (dev build/ vs installed layout), scrapes the FFI SPINEL_LINK/SPINEL_CFLAGS markers straight from the generated C, builds the cc command (GC flags, MinGW stack, -rdynamic, overflow define), and shells out via system() for portability. The existing env-driven machinery (SPINEL_LINE_MAP / SPINEL_DEBUG / SPINEL_EMIT_* / SPINEL_RBS_SEED) is reused in-process via setenv. Default mode now produces a binary (the old spinelc default of emitting C moves under -c / -S).
Also fix a latent #line bug surfaced by this change: emit_line_directive
wrote #line wherever the statement started, so a statement emitted
mid-line (an inlined block/proc body) produced a stray '#'. It now breaks
the line first. The bug was invisible before because the gate drove
spinelc directly without line-map; the driver defaults it on.
Build/Makefile:
makebuilds the binary and a repo-rootspinelsymlink to it (dev convenience; gitignored).installships the binary asspinel.- test / bench / optcarrot rules pass
-c --no-line-map(they want plain, reproducible C; keeps the perf-sensitive optcarrot path byte-stable). - clean removes the symlink; README updated.
make gate: ALL GREEN (test 846, bench, optcarrot, self-host fixpoint).
Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]
Details
- Commit
- d1aabc72595b
- Parent
- 25251640df94
.gitignoremodifiedView file
/build//legacy/build//vendor/# Dev convenience symlink to build/spinelc (created by `make`)/spinel# Temp files/tmp/MakefilemodifiedView file
Loading diff…
README.mdmodifiedView file
Loading diff…
spineldeleted
Loading diff…
src/codegen_stmt.cmodifiedView file
Loading diff…
src/main.cmodifiedView file
Loading diff…