Commit 4ce9f66a
4ce9f66a7290Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 4 files · +2 added · ~2 modified
Description
build: move string->number parsers into libspinel_rt.a (sp_core.c)
First step of slimming sp_runtime.h, which is re-parsed in every
generated translation unit (600+ times across make test). The cold,
self-contained sp_str_to_i_* / sp_str_to_f_strict parsers now live in
lib/sp_core.c (compiled once into libspinel_rt.a) and are declared via
lib/sp_core.h, mirroring the sp_time.c split. sp_raise_cls / sp_sprintf
become external so the archived code can call them at link time.
The bootstrap binaries previously linked without libspinel_rt.a; they now link it (it was already a prerequisite), since the compiler itself uses these parsers. This unblocks moving further cold, non-inline helpers out of the header in follow-ups. install now ships sp_core.h and sp_time.h (the latter was a pre-existing gap).
Bootstrap converges; 640 tests pass; optcarrot checksum 59662.
Details
- Commit
- 4ce9f66a7290
- Parent
- 7ed159b52c93
MakefilemodifiedView file
@mkdir -p build $(CC) -c -O2 -Wno-all $(SEC_FLAGS) -Ilib lib/sp_time.c -o build/sp_time.obuild/sp_core.o: lib/sp_core.c lib/sp_core.h @mkdir -p build $(CC) -c -O2 -Wno-all $(SEC_FLAGS) -Ilib lib/sp_core.c -o build/sp_core.oSP_RT_LIB = lib/libspinel_rt.a$(SP_RT_LIB): $(RE_OBJ) build/sp_bigint.o build/sp_crypto.o build/sp_pack.o build/sp_strscan.o build/sp_time.o$(SP_RT_LIB): $(RE_OBJ) build/sp_bigint.o build/sp_crypto.o build/sp_pack.o build/sp_strscan.o build/sp_time.o build/sp_core.o ar rcs $@ $^regexp: $(SP_RT_LIB) ruby spinel_codegen.rb build/codegen.ast build/codegen.ir build/codegen1.cspinel_analyze$(EXE): build/analyze1.c $(SP_RT_LIB) $(CC) $(BOOTSTRAP_CFLAGS) -Ilib build/analyze1.c $(LDFLAGS) -lm -o spinel_analyze$(EXE) $(CC) $(BOOTSTRAP_CFLAGS) -Ilib build/analyze1.c $(SP_RT_LIB) $(LDFLAGS) -lm -o spinel_analyze$(EXE)spinel_codegen$(EXE): build/codegen1.c $(SP_RT_LIB) $(CC) $(BOOTSTRAP_CFLAGS) -Ilib build/codegen1.c $(LDFLAGS) -lm -o spinel_codegen$(EXE) $(CC) $(BOOTSTRAP_CFLAGS) -Ilib build/codegen1.c $(SP_RT_LIB) $(LDFLAGS) -lm -o spinel_codegen$(EXE)# ---- Self-hosting verification ----# After CRuby builds spinel_{analyze,codegen}, run them on each ./spinel_codegen$(EXE) build/analyze.ast build/analyze2.ir build/analyze2.cbuild/bin2_analyze$(EXE): build/analyze2.c $(SP_RT_LIB) $(CC) $(BOOTSTRAP_CFLAGS) -Ilib build/analyze2.c $(LDFLAGS) -lm -o build/bin2_analyze$(EXE) $(CC) $(BOOTSTRAP_CFLAGS) -Ilib build/analyze2.c $(SP_RT_LIB) $(LDFLAGS) -lm -o build/bin2_analyze$(EXE)build/codegen2.ir: build/codegen.ast spinel_analyze$(EXE) ./spinel_analyze$(EXE) build/codegen.ast build/codegen2.ir ./spinel_codegen$(EXE) build/codegen.ast build/codegen2.ir build/codegen2.cbuild/bin2_codegen$(EXE): build/codegen2.c $(SP_RT_LIB) $(CC) $(BOOTSTRAP_CFLAGS) -Ilib build/codegen2.c $(LDFLAGS) -lm -o build/bin2_codegen$(EXE) $(CC) $(BOOTSTRAP_CFLAGS) -Ilib build/codegen2.c $(SP_RT_LIB) $(LDFLAGS) -lm -o build/bin2_codegen$(EXE)build/analyze3.ir: build/analyze.ast build/bin2_analyze$(EXE) ./build/bin2_analyze$(EXE) build/analyze.ast build/analyze3.ir install -m 644 spinel_codegen.rb $(SPNLDIR)/ install -m 644 lib/libspinel_rt.a $(SPNLDIR)/lib/ install -m 644 lib/sp_runtime.h $(SPNLDIR)/lib/ install -m 644 lib/sp_core.h $(SPNLDIR)/lib/ install -m 644 lib/sp_time.h $(SPNLDIR)/lib/ install -m 644 lib/*.rb $(SPNLDIR)/lib/ install -d $(PREFIX)/bin ln -sf $(SPNLDIR)/spinel $(PREFIX)/bin/spinellib/sp_core.caddedView file
Loading diff…
lib/sp_core.haddedView file
Loading diff…
lib/sp_runtime.hmodifiedView file
Loading diff…