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.

Runtime, interpreter: Int promotes to a big integer on overflow (issue #47)

An Int outside 63 bits is now a TAG_BIGINT block (a signed limb count,
then 64-bit limbs) instead of a panic. Results are canonical: anything
that fits is a small int, so word equality still decides comparisons
with small ints and literal switches are unchanged.

tl_int_add, tl_int_sub and (newly inline) tl_int_mul keep their fast
path for two small ints, with one more test; anything else calls the
runtime's slow path (tilrt/src/int.rs, num-bigint). They no longer
unwind, so generated code drops the yield check after them, and
tl_int_overflow is gone. Comparisons, division, show, hash and
string.to_int handle big integers; runtime functions that use an Int as
an index, count or duration saturate a big one.

This is ABI version 2: generated main calls tl_abi_check first, so a
stale runtime stops with a message. The interpreter's Int is an i64
within 63 bits or an Rc<BigInt>, through the same crate, so both
backends compute, print and hash alike (tests/run/bigint.til). The
overflow panic test now checks division by zero; the ABI spike checks
promotion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

olivier · il y a 1 mois · ffc6ccfd6463db1646082e3a502d5930a68487bf

Parents 5c70a18

26 fichiers modifiés, 753 ajouts, 224 suppressions

Mcrates/tilc_codegen_c/src/emit.rs+2−4