turbo-tasks-backend: simplify the collectibility predicate and collect transient tasks (#98615)
Fix refcounting for transient tasks
- ensure transient tasks refcount each other correctly, and are eligible
for collection
- ensure root tasks are born with a transient_ref_count of 1
Also drop some ultimately harmful conditions from the gc predicate
- don't consider `cell_dependent`. cell dependencies form cycles and are
subsumed by ancestors
- to read a cell you have to read it from a child (covered by
parent_count) or be passed it from a parent. For the parent to have
passed it to you it must have a child dependency on the producer or be
passed it by its parent (recursively). So the task that passed you the
vc must be holding ownership over both tasks.
- therefore a stale cell_dependency can only exist within a task that is
effectively dead, however because we do not reliably clean up all tasks
in a session (due to leaking root tasks), we cannot fully exclude the
existence of stale cell_dependency edges. We just know they must only
exist within unreachable tasks.
---------
Co-authored-by:
Claude Opus 5 (1M context) <noreply@anthropic.com>
Showing
Please
register
or
sign in
to comment