tobogganSe connecter

louise

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

Codegen: fast integer paths — range analysis skipping proven overflow checks (ADR 0046 piece 3, issue #191)

A whole-program interval analysis (louise_codegen_c::ranges): a value is
Small(lo, hi) when proven a small integer in range, Big when unknown
(maybe a big integer, maybe not an Int), Bottom when unobserved.
Parameters take their ranges from every direct call site, iterated to a
fixpoint over the call graph with widening to coarse thresholds — safety
needs |value| <= 2^60, never exactness — and guards refine the arms of a
switch on a comparison, so loop counters prove out while accumulators
that no guard bounds honestly stay Big. The C backend then emits
tl_int_add/sub/mul_unchecked (new in the generated prelude) where both
operands are proven: no tag test, no overflow branch. The checked path
computes the same value in that case, so the interpreter (which always
promotes) agrees; the differential suite holds. LOUISE_NO_FAST_INTS
turns it off.

The analysis found and I fixed en route: Bottom must be neutral through
arithmetic (joining it into Big poisoned every seed); widening past the
last threshold must go to Big or the fixpoint never terminates; compare
guards take literals on either side.

Instructions (LOUISE_THREADS=1, deterministic): arith -26.2%, floats
-17.0% (its Int counter), arrays -4.8%, fib -3.1%, parallel -3.1%,
selective -1.4%, dict -1.2%, effects -0.9%; the rest within ±0.4%.
Piece 1's revision and piece 2's numbers are in ADR 0046 Revision 1.

olivier · il y a 1 mois · e0210f8af4bf0eb239c5c3183ca036b87357f2de

Parents cd2e5a5

6 fichiers modifiés, 816 ajouts, 2 suppressions

Mcrates/louise_codegen_c/src/emit/mod.rs+18−0
Mcrates/louise_codegen_c/src/emit/prelude.h+17−1
Mcrates/louise_codegen_c/src/lib.rs+1−0
Acrates/louise_codegen_c/src/ranges.rs+650−0
Acrates/louise_codegen_c/tests/int_paths.rs+129−0