Skip to content

-mm=own: fixes from mm_fuzz.py campaigns; --deep fuzzer mode - #1130

Open
ASDAlexander77 wants to merge 2 commits into
mainfrom
fix-own-fuzz-finds
Open

ASDAlexander77 wants to merge 2 commits into
mainfrom
fix-own-fuzz-finds

Conversation

@ASDAlexander77

@ASDAlexander77 ASDAlexander77 commented Dec 4, 2026 •

Copy link
Copy Markdown
Owner

Fixes for what mm_fuzz.py found in three campaigns against the TSLANG 240 build (1,500 programs each: --classes, the new --deep, --classes again), plus the new --deep mode.

Regressions from TSLANG 240 (counting every argument form)

  • const r = g(h, h.n) where g returns its argument: the count on h.n was given back right after the call while r still used it. It now lasts until r's last use (the call's result is followed like a view).
  • k.self().drain(k.arr[0]) with drain overridden in a subclass: the virtual call's this/method (GetThis/GetMethod of ThisVirtualSymbolRef) wasn't traced back to k, so the drop was missed. Neither counted nor refused.
  • f({ v: g.items[0] }): a counted read stored into the object literal's field was given back after the store. Now not counted (refused, as before 240).
  • A counted read used again by a call inside a try (an invoke ends its block) had its count given back before that call. Now not counted (refused).

Older holes

  • k.drain(k.at(0)) on a module-level k: each mention of a global is its own load, and the chain under a lent result had no known roots. all_of over no roots made the owned-root shortcut say "nothing dropped". The shortcut now needs a root; argumentOwnsApart follows lent sources (lentSources) and matches reads of the same global.
  • A closure capturing a parameter in a function that also returns a borrow of it (p.setCb(() => p.x); return p.arr[0];): the box's copy was taken for the returned value's reference. Now refused like any other such capture.
  • f(p, p) of a parameter p given to a callee that keeps both: the two moves were taken as moves on exclusive paths. Now a use after move.

Tests

  • 00tslang_issue_240_fuzz runs under gc/rc/none/own, JIT and compiled.
  • Four new own_err_* cases.
  • Full suite 10,523/10,523 locally. All 30 minimized fuzz repros now print the same as gc. A 1,500-program --deep campaign on the fixed compiler had no failures.

rc: k.arr[i] = g(k) where g replaces k.arr (found by the last campaign)
rc released the array the left side read inside g, then stored into it and grew it. The array is now held in a slot the scope owns, retained right after the read. The scope gives it back at its end, or on the unwind if the call throws. A release right after the store would leak the array on a throw, which is why this case had been left open. In module-level code, where no scope owns slots, the array is released after the store.

  • Only applies when the right side calls something and the array comes from a place the call can reach (a field, not a local). In a micro-benchmark of 20M this.data[i] = f(i) stores: about 20 ms, against 15 ms through a local alias.
  • Test: 00rc_element_store_array_replaced_by_call under gc/rc/none, including a throwing call in try/catch, plus an rc IR check. mm_fuzz.py leaks on it shows no rc growth.

🤖 Generated with Claude Code

ASDAlexander77 and others added 2 commits December 4, 2026 22:13
Found by running mm_fuzz.py --classes and a new --deep mode against the TSLANG 240 build:

- A call's result that borrows a counted argument (`const r = g(h, h.n)` of a `g` returning its
  argument) holds the count until its own last use, not just the call.
- A virtual call through `this` lent back (`k.self().drain(k.arr[0])` of an overridden `drain`)
  and a call on a module-level object (`k.drain(k.at(0))`, each mention a load of its own) reach
  what the borrow was read from: counted, where they were neither counted nor refused.
- A chain with no root known no longer takes the owned-root shortcut (all_of over no roots).
- A counted read stored into a record (`f({ v: g.items[0] })`) or used by a call in a `try`
  (an invoke ends its block) is not counted: refused as before TSLANG 240.
- A closure's copy of a parameter in a function that returns a borrow of it is checked as a
  capture (refused), not taken for the returned value's reference.
- A parameter given twice to one call that keeps both is a use after move.

mm_fuzz.py --deep adds a subclass overriding K's methods, a getter/setter, a call that throws
after freeing, and a generator method.

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

Found by mm_fuzz.py --classes: a call on the right side that gives the place another array
released the one the left side read, and the store and the growth went into a freed block.
The array is now held in a slot the scope owns, retained right after its read: given back where
the scope ends, and on the unwind when the call throws (a release after the store would leak it
then - why the call case was left open). In module-level code, where no scope owns slots, it is
released after the store.

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

This branch has not been deployed

No deployments
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