tobogganSe connecter

louise

The Louise language: compiler, runtime, std, tooling

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

Codegen: escape analysis in the unbox planner; evidence keeps unboxed signatures (#337 groundwork)

Three pieces, all internal to the compiler (no ABI change; ADR 0045/0046
precedent):

**`Walker::escape` is no longer a no-op.** The walk records every
variable flowing to a box position (constructor/tuple/closure fields,
call and operation payloads — the sites were already there, calling a
stub). The record drives the planner's first cross-function
qualification: a float worker's non-tail call of another function that
has a float worker keeps the result **raw** when the variable never
escapes — no box at the call, no unbox at the use. (An escaping result
is boxed at the call exactly as before; the boundary boxes a raw local
at any later escape, so raw-keeping is never worse than once-per-escape
boxing.) `plan()` walks callees first so the caller sees the callee's
plan. Int calls stay boxed: an int worker can bail, and the recompute's
box is not proven small (a follow-up could use the callee's range).
All existing refusals are unchanged (cross-function tail calls, `exit`,
reuse tokens on raw values, the int purity gate).

**Emitter: `worker_args` shared by the self-call and cross-worker arms,
and a latent-leak fix in `call_worker`.** The float boundary boxed a
raw local of the caller (`tl_float_get(tl_float_from(ctx, v))`); for a
*borrowed* marked parameter nobody freed that box. No test hit it
(worker-calling-worker was rare before), and `tests/run/float_worker.lse`
now covers it: `total`'s worker calls `bump`'s with a raw argument and
keeps the result raw (`v10 = bump$uf(...); v13 = v2 + v10;` — no
`tl_float_from` anywhere on the path), ending with 0 live blocks, both
optimisation modes.

**Evidence: broader `Known` coverage, `unbox_sig` preserved on copies.**
A tuple of known values is now known field by field, so an evidence
bundle built in one place and projected in another keeps its methods
direct. And a specialised copy keeps the original's unboxed signature
(the parameter list and result type are unchanged), so a specialised
numeric function gets a worker of its own — more Float/Int
qualifications without touching the lowering gate. The other passes'
policies are commit 2's comments: `specialise` (marks no longer align
with the reshaped parameter list), `cpr`/`split`/`trmc` (vacuous:
tuple results, refused signatures, the extra context parameter),
`fuse`/`precompile` (generated, untyped) all deliberately reset.

`COPIES_PER_FUNCTION`: measured 1 vs 2 with interleaved A/B builds on
`dict` (161 vs 160 ms over three rounds), `records` (inconclusive — the
bench wanders ±10% on this machine within a round) and `floats` (even):
no consistent benefit, so it stays 1 (tightest code growth); the
measurement is recorded on the constant.

Benches (best of 5, ms, this machine; ±2% run-to-run):

    benchmark   before     after
    trees       311-327    314-320   (A/B interleaved, three rounds: even)
    records     380        378       (0%)
    floats      11         11        (0%)
    lists       143        132       (−7%; also −4…−5% on commit 2's runs)
    dict        159        158-160   (0%; the +13% in one full run did not
                                     reproduce in the locked A/B)

olivier · il y a 3 sem. · b095d3f4a920dca6e903e48f14ec550cfb1b8368

Parents 4da9d7c

4 fichiers modifiés, 348 ajouts, 40 suppressions

Mcrates/louise_codegen_c/src/emit/mod.rs+68−28
Mcrates/louise_codegen_c/src/unbox.rs+223−5
Mcrates/louise_core/src/evidence.rs+23−6