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: constant constructor trees are static, immortal blocks

A construction of constants — an HTML literal's static subtree, a
template's parts list, a tuple of literals — is immutable, so one
static block (rc 0, like a string literal's) serves every evaluation
instead of being rebuilt cell by cell. Blocks are content-named, so
equal trees share, in and across functions; literals they hold keep
their own static blocks, emitted ahead of the trees that refer to
them.

Sharing is unobservable: values are immutable and every equality in
the language is structural (there is no pointer-identity primitive).
An immortal block is never unique, so Perceus' reuse never writes it,
and dup/drop of it are no-ops. The interpreter is unchanged: it keeps
building the tree per call, which the same argument covers.

LOUISE_NO_STATIC_CTORS rebuilds at run time, for bisecting.

tests/run/html_hoist.lse pins the behaviour on both backends (holes
still evaluate left to right, effects included); static_ctors.rs
checks the emitted C and that a loop over a static subtree allocates
a constant number of blocks.

Bench (checked runtime, this host): html 3.20M -> 2.80M allocs
(-12.5%), ssr 16.88M -> 13.53M allocs (-19.9%); instructions
-4.6% (html) and -7.4% (ssr). Checksums unchanged.

olivier · il y a 1 mois · 2c2381fc5f27cdb84e4410b53728782ddc103d8a

Parents 860d8b6

3 fichiers modifiés, 429 ajouts, 9 suppressions

Mcrates/louise_codegen_c/src/emit/mod.rs+146−9
Acrates/louise_codegen_c/tests/static_ctors.rs+222−0