|
1 | 1 | # Changelog |
2 | 2 |
|
| 3 | +## v0.381.0 — C Micro-refactor: Hygiene, Identity-by-name, Dispatch Tables, God-function Splits |
| 4 | + |
| 5 | +Closes the file/function-level cleanup the architecture cycles |
| 6 | +deferred. Behavior-preserving throughout — every commit kept the |
| 7 | +full test suite green (1371 tests, 4828 assertions) and the mino-tests |
| 8 | +batteries (adv-test 18/18, diff-test 7/7, fault-inject 5/5, |
| 9 | +test-migrated 483 tests / 3397 assertions). |
| 10 | + |
| 11 | +### Hygiene |
| 12 | + |
| 13 | +Stripped tracking metadata out of source comments so they describe |
| 14 | +intent instead of release history: |
| 15 | + |
| 16 | +- `vX.Y.Z` version stamps removed from 15+ sites across `runtime/`, |
| 17 | + `prim/`, `eval/`, and `eval/bc/jit/`. |
| 18 | +- `Phase N` / `Cycle N` breadcrumbs removed from `eval/fn.c`, |
| 19 | + `eval/defs.c`, `runtime/internal.h`. |
| 20 | +- "legacy" annotations rewritten without the legacy framing |
| 21 | + (transient wrappers, JIT slab-vs-mmap path, regex string source, |
| 22 | + reader depth cap, `gc_tick_should_suppress`). |
| 23 | +- `gc_sweep` doc aligned with what the body actually does |
| 24 | + (it does walk all_young, both to clear major-frontier mark bits |
| 25 | + and to tally live young bytes). |
| 26 | + |
| 27 | +### Identity-by-name for primitives |
| 28 | + |
| 29 | +Pointer-comparing `as.prim.fn` to detect canonical prims was |
| 30 | +fragile: it would treat two distinct argv-only prims (both with |
| 31 | +`fn == NULL`) as equal. Switched every identity-check site to the |
| 32 | +stable registered name: |
| 33 | + |
| 34 | +- `mino_eq` for `MINO_PRIM` is now allocation-pointer equality |
| 35 | + (each prim is allocated once per state, so this is correct and |
| 36 | + fastest). |
| 37 | +- `compile.c`'s pure-prim shadow-check uses `strcmp` against the |
| 38 | + recorded name. |
| 39 | +- `sequences.c`'s `classify_subseq_test`, `reduce_int_kind_from_fn`, |
| 40 | + and `pipeline_fast_callable` all match by name. |
| 41 | +- `reduce_step`'s per-element identity check was hoisted into a |
| 42 | + `reduce_int_kind_t kind` parameter the caller classifies once, |
| 43 | + so the inner loop runs a small switch rather than per-element |
| 44 | + `strcmp`. |
| 45 | +- The install-time dual-fill hack in `prim/install.c` no longer |
| 46 | + carries the "identity-pin" justification (it stays as a pure |
| 47 | + ABI-compat shim until the cons-spine port lands). |
| 48 | + |
| 49 | +### Dispatch tables / per-handler extraction |
| 50 | + |
| 51 | +Five tag-dispatch switches reshaped so each branch reads as a |
| 52 | +named unit: |
| 53 | + |
| 54 | +| Switch | File | Shape | |
| 55 | +|-------------------------|-------------------------------|------------------------------------------| |
| 56 | +| `mino_iter_next` | `collections/iter.c` | `{kind, iter_step_fn}` table | |
| 57 | +| `read_dispatch` | `eval/read.c` | `{char, read_dispatch_fn}` table | |
| 58 | +| `mino_print_to` | `eval/print.c` | per-tag `print_*` helpers, switch driver | |
| 59 | +| `mino_eq` | `values/val.c` | `eq_cross_type` helper + identity group | |
| 60 | +| `prim_conj` | `prim/collections.c` | per-kind `conj_*` helpers | |
| 61 | + |
| 62 | +### God-function splits |
| 63 | + |
| 64 | +`compile_call_impl` was the Tier-1 target. 614-line dispatcher |
| 65 | +shrinks to a 77-line orchestrator with nine `try_emit_*` helpers |
| 66 | +(arith unop, n-arity arith, two-arg binop, collection-op |
| 67 | +arity-2/1/3, keyword-as-fn, IC-cached call, plain call) plus two |
| 68 | +`{name, opcode}` tables that fold seven shape-identical 2-arg ops |
| 69 | +(nth, get, conj, dissoc, conj!, dissoc!, disj!) and three 1-arg |
| 70 | +read ops (first, count, empty?) into single dispatch entries. |
| 71 | + |
| 72 | +| Function | Before | After | |
| 73 | +|---------------------------|-------:|------:| |
| 74 | +| `compile_call_impl` | 614 | 77 | |
| 75 | +| `main` | 488 | 296 | |
| 76 | +| `mino_print_to` | 486 | ~80 | |
| 77 | +| `bind_vec_destructure` | 193 | 80 | |
| 78 | +| `apply_callable` (PRIM) | 54 | 3 | |
| 79 | + |
| 80 | +`run_repl` extracted from `main`. `apply_prim_cons` extracted |
| 81 | +from `apply_callable` (with a shared `current_call_location` |
| 82 | +helper for the file/line/col lookup that fn.c repeats around every |
| 83 | +`push_frame`). `vec_destructure_args` extracted from |
| 84 | +`bind_vec_destructure` — the value-to-cons normaliser is now its |
| 85 | +own ~80-line helper with three named cases (vector / map-entry / |
| 86 | +lazy-or-chunked). |
| 87 | + |
| 88 | +The FN/MACRO branches of `apply_callable`, `bc_run_dispatch_from` |
| 89 | +(~1180 lines), and `mino_jit_compile_inner` are documented as |
| 90 | +deferred — each carries tail-call trampoline / per-pass-state |
| 91 | +invariants that are real changes rather than pure motion. |
| 92 | + |
| 93 | +### Process notes |
| 94 | + |
| 95 | +The Cycle 2 plan assumed all primitives already used the argv ABI |
| 96 | +and that `fn` was kept only for identity tagging. Survey at |
| 97 | +execution time showed the opposite: 344 of 386 prim entries use |
| 98 | +the cons-spine `fn` only. Dropping the `fn` field is its own |
| 99 | +multi-file port and was carved out into a follow-up cycle; this |
| 100 | +release ships the identity-by-name fix that makes that future |
| 101 | +port mechanical instead of behavioral. |
| 102 | + |
| 103 | +The `bc_run_dispatch_from` / `mino_jit_compile_inner` / quasiquote |
| 104 | +splits are documented in `.local/micro-refactor-plan.md` as |
| 105 | +deferred targets — each is sizable structural work that earns its |
| 106 | +own cycle. |
| 107 | + |
| 108 | +**Verification.** Full mino test suite green (1371 tests, 4828 |
| 109 | +assertions). mino-tests adv-test (18/18 probes), diff-test (7/7), |
| 110 | +test-fault-inject (5/5), test-migrated (483 tests / 3397 |
| 111 | +assertions) all green after companion fix in mino-tests |
| 112 | +(`gc_generational_test` switched to a `mapv inc (range N)` |
| 113 | +workload that still exercises the generational invariant under |
| 114 | +mino's now-fused lazy-seq paths). |
| 115 | + |
3 | 116 | ## v0.380.0 — Architecture Cycle 6c: Splits in numeric / collections / sequences |
4 | 117 |
|
5 | 118 | Closes the cycle 6 deferred work on the three plan-named mega-files. |
|
0 commit comments