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: counts saturate; checked builds verify extern unwinding and xargs (#217)

Reference counts no longer overflow. A local count stops at TL_RC_STUCK
(INT32_MAX), and tl_dup and tl_drop leave it there. A shared count that
reaches -2^29 is held at -2^30 by each atomic dup or drop that sees it,
so dups and drops in flight on other threads can't bring it to -1 or
wrap it, without a compare-and-swap loop. Either way the block is never
freed: a bounded leak instead of a use after free, reported once on
stderr. The block is not made immortal, because immortal blocks are
shared between actors as they are and this one may hold counted
children. The cost is one instruction in tl_dup and tl_drop: +0.6% to
+3.9% instructions on tests/bench's refcounting programs, with cycles
within run-to-run noise.

Debug builds of generated code define TL_CHECKED and call tl_checked().
In those builds (louise_rt/src/checked.rs):
- each call of an extern the table marks as never unwinding goes through
  TL_NO_UNWIND, and a panic or a park inside it aborts, naming the
  extern. Every tests/run program now runs natively this way, and none
  trips it.
- the runtime poisons the xargs slots at each slice, and a callee copies
  them through TL_XARG, which aborts on a poisoned slot.
Release builds are unchanged.

The spike covers saturation through the inline tl_dup and tl_drop, and
both checks (in a forked child). heap.rs tests both count paths.
tests/ui/derives.lse follows the derive message fixed in the previous
commit.

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

olivier · il y a 4 sem. · f6abc8253daa176c6673f9279a4d475073a4d16a

Parents db09693

13 fichiers modifiés, 322 ajouts, 27 suppressions