kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

commit 1ccdd814588c5b6750f3f0aca37b47b9aed6907a
parent a3e7b03a7d9a882ee7f73e48a7ccfffd0f44dd44
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Wed,  3 Jun 2026 15:04:23 -0700

doc: regenerate CODE_SIZE.md after the economy refactor

Diffstat:
Mdoc/CODE_SIZE.md | 156++++++++++++++++++++++++++++++++++++++++----------------------------------------
1 file changed, 78 insertions(+), 78 deletions(-)

diff --git a/doc/CODE_SIZE.md b/doc/CODE_SIZE.md @@ -7,28 +7,28 @@ headers, excluding comments and blanks), via `cloc`. > Snapshot: 2026-06-03. Regenerate with `make code-size` (or > `scripts/code_size.sh`); these numbers drift as the tree changes. -## Arch backends — `src/arch/` (37,920) +## Arch backends — `src/arch/` (38,578) | Component | Lines | |---|---:| -| aarch64 (`aa64`, reference backend) | 9,112 | -| x86-64 (`x64`) | 8,355 | -| riscv64 (`rv64`) | 8,345 | -| WebAssembly (`wasm`) | 6,214 | -| C-source backend (`c_target`) | 3,882 | -| shared core (ArchImpl, MCEmitter, disasm, dwarf, registry) | 2,012 | +| aarch64 (`aa64`, reference backend) | 9,344 | +| x86-64 (`x64`) | 8,424 | +| riscv64 (`rv64`) | 8,489 | +| WebAssembly (`wasm`) | 6,256 | +| C-source backend (`c_target`) | 3,962 | +| shared core (ArchImpl, MCEmitter, disasm, dwarf, registry) | 2,103 | -## Object model — `src/obj/` (14,142) +## Object model — `src/obj/` (13,999) | Component | Lines | |---|---:| -| ELF | 4,289 | -| Mach-O | 3,780 | -| COFF/PE | 3,266 | -| Wasm object | 191 | -| core (format-neutral model, registry, reloc apply, TLS) | 2,616 | +| ELF | 4,209 | +| Mach-O | 3,756 | +| COFF/PE | 3,235 | +| Wasm object | 187 | +| core (format-neutral model, registry, reloc apply, TLS) | 2,612 | -## Linker — `src/link/` (6,958) +## Linker — `src/link/` (6,588) Entirely **format-neutral** — no per-format files; emits through the `obj/` format writers above. Covers resolve, layout, relocation, linker scripts, @@ -38,9 +38,9 @@ incremental linking, and the JIT image mapper. | Frontend | Lines | |---|---:| -| C compiler (`lang/c`: parse/type/decl/ABI-lower) | 12,348 | -| toy (CG-API exercise frontend) | 9,210 | -| cpp (C lexer + preprocessor; shared by C frontend & `cpp`) | 3,726 | +| C compiler (`lang/c`: parse/type/decl/ABI-lower) | 12,342 | +| toy (CG-API exercise frontend) | 9,096 | +| cpp (C lexer + preprocessor; shared by C frontend & `cpp`) | 3,672 | | wasm/WAT | 3,711 | The full C compiler ≈ `lang/c` + `lang/cpp`, driving the shared @@ -50,68 +50,68 @@ The full C compiler ≈ `lang/c` + `lang/cpp`, driving the shared | Subsystem | Lines | |---|---:| -| optimizer (`opt`, -O1 SSA/regalloc) | 16,680 | -| codegen (`cg`, public CG API + IR) | 11,349 | -| api (composition layer) | 6,800 | -| debug/DWARF (`debug`) | 6,094 | -| dist (CAS + `.kpkg`) | 5,147 | +| optimizer (`opt`, -O1 SSA/regalloc) | 16,476 | +| codegen (`cg`, public CG API + IR) | 11,454 | +| api (composition layer) | 6,935 | +| debug/DWARF (`debug`) | 6,026 | +| dist (CAS + `.kpkg`) | 4,773 | | interp (bytecode interpreter) | 2,547 | -| emu (guest-ELF emulator) | 2,401 | +| emu (guest-ELF emulator) | 2,335 | | asm (standalone + inline assembler) | 1,962 | -| core (arenas/maps/bufs/diag/hash) | 1,377 | +| core (arenas/maps/bufs/diag/hash) | 1,416 | | abi (calling conventions) | 1,185 | | dbg (debugger) | 1,098 | | os (emu syscall personality) | 806 | | jit (stub; real mapper lives in `link`) | 12 | -### dist split — `src/dist/` (5,147) +### dist split — `src/dist/` (4,773) | Component | Lines | |---|---:| -| packaging (manifest/kpkg/tar/trust) | 2,032 | +| packaging (manifest/kpkg/tar/trust) | 1,658 | | vendored compression (deflate/lz4) | 1,976 | | CAS store (blob/tree/cas) | 749 | | vendored crypto (blake2b/ed25519/b64/minisig) | 390 | -## Driver — `driver/` (23,079) +## Driver — `driver/` (23,447) | Area | Lines | |---|---:| -| cmd (per-subcommand) | 16,334 | +| cmd (per-subcommand) | 16,485 | | env (host adapters) | 3,834 | -| lib (shared support) | 2,411 | -| `*.c` (main + dispatch) | 500 | +| lib (shared support) | 2,607 | +| `*.c` (main + dispatch) | 521 | ### driver/cmd per-subcommand | Subcommand | Lines | |---|---:| -| dbg.c | 2,991 | -| cc.c | 2,634 | -| objdump.c | 1,710 | -| ld.c | 1,161 | -| run.c | 889 | +| dbg.c | 3,000 | +| cc.c | 2,652 | +| objdump.c | 1,716 | +| ld.c | 1,169 | +| run.c | 909 | | objcopy.c | 669 | | strip.c | 579 | | pkg.c | 575 | | ar.c | 546 | -| compile.c | 501 | +| compile.c | 514 | | xxd.c | 428 | | nm.c | 341 | | size.c | 327 | +| emu.c | 292 | | cas.c | 289 | -| emu.c | 283 | -| mc.c | 262 | -| disas.c | 249 | +| mc.c | 279 | +| disas.c | 270 | | cmp.c | 237 | +| as.c | 235 | | compress.c | 232 | | strings.c | 226 | -| as.c | 220 | +| cpp.c | 204 | | ranlib.c | 203 | | install.c | 202 | | addr2line.c | 199 | | hash.c | 192 | -| cpp.c | 189 | ## Outside `src/` @@ -119,13 +119,13 @@ The full C compiler ≈ `lang/c` + `lang/cpp`, driving the shared |---|---:| | rt/ (freestanding runtime) | 5,167 | | vendor/ (monocypher, lz4) | 9,077 | -| include/kit (public headers) | 2,935 | +| include/kit (public headers) | 2,768 | ## Binary code size (release `kit`) Live `__TEXT`+`__DATA` symbol bytes attributed to each component from the release binary's linker map (`-Wl,-map`, after `-dead_strip`). Total -attributed: **2,298,147 bytes** across 15,018 symbols' worth of objects. This is +attributed: **2,303,837 bytes** across 14,947 symbols' worth of objects. This is compiled machine code + data, so the shape differs from source lines — optimizer/codegen-heavy components weigh more here than their line counts suggest. @@ -133,18 +133,18 @@ optimizer/codegen-heavy components weigh more here than their line counts sugges | Component | Bytes | |---|---:| -| aarch64 (`aa64`) | 143,665 | -| x86-64 (`x64`) | 112,572 | -| riscv64 (`rv64`) | 125,823 | -| WebAssembly (`wasm`) | 90,812 | -| C-source backend (`c_target`) | 62,105 | -| shared core | 9,588 | +| aarch64 (`aa64`) | 147,694 | +| x86-64 (`x64`) | 113,823 | +| riscv64 (`rv64`) | 126,704 | +| WebAssembly (`wasm`) | 91,382 | +| C-source backend (`c_target`) | 65,010 | +| shared core | 9,848 | ### Object formats | Component | Bytes | |---|---:| -| ELF | 43,012 | +| ELF | 43,011 | | Mach-O | 57,123 | | COFF/PE | 30,166 | | Wasm object | 1,883 | @@ -154,29 +154,29 @@ optimizer/codegen-heavy components weigh more here than their line counts sugges | Component | Bytes | |---|---:| -| linker (`src/link`) | 91,806 | +| linker (`src/link`) | 89,526 | ### Frontends | Component | Bytes | |---|---:| -| C compiler (`lang/c`) | 153,809 | -| toy | 107,884 | -| cpp (lexer + preprocessor) | 59,881 | -| wasm/WAT | 61,054 | +| C compiler (`lang/c`) | 153,731 | +| toy | 106,475 | +| cpp (lexer + preprocessor) | 56,485 | +| wasm/WAT | 60,951 | ### Other subsystems | Component | Bytes | |---|---:| -| optimizer (`opt`) | 171,344 | -| codegen (`cg`) | 147,994 | -| api (composition) | 68,790 | -| debug/DWARF (`debug`) | 54,798 | -| interp (bytecode) | 30,907 | -| emu (guest-ELF) | 22,232 | +| optimizer (`opt`) | 171,192 | +| codegen (`cg`) | 150,023 | +| api (composition) | 70,399 | +| debug/DWARF (`debug`) | 54,619 | +| interp (bytecode) | 31,727 | +| emu (guest-ELF) | 22,224 | | asm (assembler) | 33,509 | -| core (arenas/maps/…) | 7,441 | +| core (arenas/maps/…) | 7,509 | | abi (calling conv) | 8,671 | | dbg (debugger) | 8,160 | | os (emu syscalls) | 5,487 | @@ -186,7 +186,7 @@ optimizer/codegen-heavy components weigh more here than their line counts sugges | Component | Bytes | |---|---:| -| packaging (manifest/kpkg/tar/trust) | 21,297 | +| packaging (manifest/kpkg/tar/trust) | 21,304 | | vendored compression (deflate/lz4) | 111,648 | | CAS store (blob/tree/cas) | 9,677 | | vendored crypto (blake2b/ed25519/b64/minisig) | 4,619 | @@ -195,39 +195,39 @@ optimizer/codegen-heavy components weigh more here than their line counts sugges | Component | Bytes | |---|---:| -| cmd (all subcommands) | 221,077 | -| env (host adapters) | 22,258 | -| lib (shared support) | 28,197 | +| cmd (all subcommands) | 223,117 | +| env (host adapters) | 22,238 | +| lib (shared support) | 30,676 | | `main.c` (dispatch) | 5,101 | ### driver/cmd per-subcommand | Component | Bytes | |---|---:| -| dbg | 45,001 | -| cc | 30,583 | -| objdump | 26,017 | -| ld | 15,728 | -| run | 11,898 | +| dbg | 45,085 | +| cc | 30,987 | +| objdump | 26,053 | +| ld | 15,752 | +| run | 12,122 | | pkg | 9,181 | | xxd | 8,255 | | objcopy | 7,887 | | ar | 7,814 | -| compile | 6,303 | +| compile | 6,507 | | strip | 5,962 | | size | 3,917 | +| emu | 3,777 | | nm | 3,741 | -| emu | 3,725 | | cas | 3,696 | +| mc | 3,641 | +| disas | 3,515 | +| as | 3,367 | | install | 3,365 | -| mc | 3,353 | -| as | 3,231 | | compress | 3,108 | -| disas | 3,063 | | cmp | 2,912 | | strings | 2,828 | +| cpp | 2,508 | | ranlib | 2,503 | -| cpp | 2,372 | | addr2line | 2,361 | | hash | 2,273 | @@ -236,4 +236,4 @@ optimizer/codegen-heavy components weigh more here than their line counts sugges | Component | Bytes | |---|---:| | vendor/ (monocypher, lz4) | 34,348 | -| (unattributed / linker synthesized) | 109,244 | +| (unattributed / linker synthesized) | 103,612 |