Skip to content

mem: --mem gives each reuse a region verdict and lists the sanity checks that must stay empty - #77

Merged
vic merged 1 commit into
mainfrom
mem-verdicts
Nov 12, 2026
Merged

vic merged 1 commit into
mainfrom
mem-verdicts

Conversation

@vic

@vic vic commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Two more parts of the --mem analysis.

Region verdict per reuse. A reuse writes the new box into the matched box's cell, so the new box lives in the matched box's region. Each reuse[] record now has def, boxAt (the line of the box its arm builds), varRegions (the regions the matched var can hold: rin), boxRegions (the regions the box would be made in: fills of its site) and verdict:

  • ok: every var region outlives (or is) every box region (outl);
  • regionShorter with varRegion and boxRegion: the matched box dies before the new box would;
  • regionUnknown: a region set is empty, so there is no proof (a def nothing calls).

M7b may write in place only for ok.

Sanity checks (fail[]). Relations that must be empty on every program (the shape of Doop's sanity.dl). First check, siteNoRegion: a site of a reached def whose box has no region (noRegion(E) :- esiteOf(E, F), reached(F), esiteNode(E, N), !hasOwn(N)). New gate check memfail/*: on every prog and mem test --mem reads, .fail is an empty array; armed: the check fails when .fail is missing, and it must read at least the mem tests.

New test tests/s2/mem/reuse_region.srs: RR.up{r} reuses a box of t for a box of r (regionShorter), RR.same reuses within t (ok), RR.lone is never called (regionUnknown). Checked by hand; the program prints 6.

Checks:

  • All old fields of the mem tests are unchanged (jq keeps the old reuse fields and drops fail).
  • fail is empty on all 139 programs; a mutant that breaks the site join (no box gets a region) makes it non-empty on 79 of them.
  • 830-output identity; fixpoint; seed updated.
  • Speed on s2c: normal compile 541,657,231 -> 541,657,315; --mem 1.904 G -> 1.928 G (+1.3%).

Mutants (each builds):

mutant killed by
regionShorter reported as ok mem/reuse_region
an empty region set reported as ok mem/reuse_region (RR.lone)
noRegion with a positive hasOwn all 13 mem tests
the site join never matches 79 programs in memfail

@vic
vic merged commit 3a75caf into main Nov 12, 2026
3 checks passed
@vic
vic deleted the mem-verdicts branch November 17, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant