Skip to content

WIP: continue explicit owner-slot migration (#1649) - #1938

Draft
fglock wants to merge 10 commits into
masterfrom
wip/alias-cell-ownership-20261030-185849
Draft

fglock wants to merge 10 commits into
masterfrom
wip/alias-cell-ownership-20261030-185849

Conversation

@fglock

@fglock fglock commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Continue the explicit owner-slot migration across #1649, #1618, and #1860.

This draft carries the no-sweeps ownership work, including exact owner identities, caller argument cell aliasing, weakly tracked cleanup that respects surviving owner slots, and interpreter pad-constant ownership. It is related to draft #1816, which carries the earlier Mojolicious/Catalyst controller and WebSocket lifetime work.

The interpreter materialization fix transfers pad constants from the temporary executable wrapper to the published Perl-owned CV. The focused code-pad final-slot regression seeds a positive legacy count to verify that owner identities can release the final slot; this is an invariant test and does not claim to reproduce natural count drift. The separate nested untracked-owner test has a real counted scalar owner (refCount == 1) and verifies that final-cell cleanup retires the nested edge without disturbing that independent owner.

The cleared-aggregate scope-exit path now checks direct Perl owner identities before using the cached external-root compatibility query. The fallback remains for ownerless cases that have not yet migrated. Queued owner releases now remain visible through their deferred count transition, so scope-exit finalization cannot race a release already in flight.

Validation on this update:

  • nice -n 19 make — passed in 7m38s; includes the package-root, cleared-aggregate, and queued owner-release regressions.
  • ClearedAggregateOwnerIdentityFinalizationTest — passed; live package-owner identity avoided external-root queries and snapshots.
  • Pad-constant ownership test — system Perl 10/10; JVM and interpreter 10/10 each with corrective sweeps disabled.
  • HTML-Tree 5.07 upstream suite — all 23 files passed: system Perl 969 tests (the leak test skipped because Test::LeakTrace is unavailable); JVM and interpreter 989 TAP checks each with corrective sweeps disabled after the cleared-aggregate change. PerlOnJava’s 20 leak-test checks use its no-op Test::LeakTrace stub and are not leak measurements. t/refloop.t passes 8/8 on all three runtimes.
  • Lifecycle matrix — system Perl, JVM, and interpreter each passed 104 assertions; PerlOnJava backends ran with corrective sweeps disabled.
  • Post-change weak/DESTROY/resurrection/cycle matrix — 8 fixtures, 68 assertions on each backend with corrective sweeps disabled.
  • Mojolicious controller and WebSocket lifetimes regress with #1642 integration #1794 controller and WebSocket cases — system Perl 15/15; after this change, JVM and interpreter each passed the controller fixture 3/3 and WebSocket fixture 6/6 with corrective sweeps disabled.
  • Avoid repeated live-root scans over growing lexical aggregates #1860 growing lexical output — system Perl and both PerlOnJava backends 4/4; after this change, JVM and interpreter each passed the fixture 4/4. Data::Tumbler stress exercised 65,536 results on all three.
  • Added issue_1649_package_nested_untracked_weak_owner.t; system Perl, JVM, and interpreter each pass 7/7 with corrective sweeps disabled.
  • lychee --offline dev/design/perl-ownership-rewrite.md — passed (14 links).
  • Cleared-aggregate legacy-count invariant — the Java test assigns a positive count directly; it checks the owner-identity boundary but is not evidence of natural count drift.
  • Pending owner-release finalizer regression — JUnit passed; a real queued counted-owner release keeps the weak observer live until the deferred decrement drains.
  • Async weak/DESTROY reproducer — JVM and interpreter each pass 2/2; the equivalent standard-Perl weak-reference/DESTROY oracle passes 2/2.
  • nice -n 19 make check-links — passed (791 links checked, 0 errors).

The ownership rewrite remains in progress. Remaining work includes the package-root compatibility pin, remaining reachability and sweep fallbacks, the rest of the ownership families, then rerun the HTML-Tree suite after those changes. Keep this PR in draft while those paths are migrated and validated.

This snapshot starts at 4d5e0841e1147231314cfec0752096fd1f381d75; GitHub master has advanced since then. Upstream integration and merge-conflict review remain before this draft can be considered merge-ready.

fglock and others added 10 commits October 30, 2026 20:07
Continue explicit Perl owner-slot migration (#1649).

Preserve weak cleanup while another owner slot is live; add caller alias and weak lifecycle regressions.

Generated with [Codex](https://openai.com/codex)

Co-Authored-By: Codex <codex@openai.com>
Continue the no-sweeps ownership migration with explicit pad-constant
release, untracked caller-cell cleanup, and focused regressions for the
interpreter and owner ledger.

Generated with [Codex](https://openai.com/codex)

Co-Authored-By: OpenAI Codex <openai-codex@users.noreply.github.com>
Document that the positive legacy count in the focused Java regression is
seeded to test the ownership boundary; it does not reproduce natural count
drift in production.

Generated with [Codex](https://openai.com/codex)

Co-Authored-By: OpenAI Codex <openai-codex@users.noreply.github.com>
Record the upstream 5.07 full-suite results on system Perl and both
sweeps-disabled backends, including the Test::LeakTrace stub limitation.

Generated with [Codex](https://openai.com/codex)

Co-Authored-By: OpenAI Codex <openai-codex@users.noreply.github.com>
Use direct Perl owner slots to skip an external-root graph query when a
cleared aggregate still has an identified owner. Keep the cached compatibility
check for ownerless cases and cover the fast path with a query-count test.

Generated with [Codex](https://openai.com/codex)

Co-Authored-By: OpenAI Codex <openai-codex@users.noreply.github.com>
Add a standard-Perl oracle test for weak observers of an untracked aggregate
held by a package array, including unweakened scalar ownership after the
package slot is removed. Record the current coverage and migration boundary.

Generated with [Codex](https://openai.com/codex)

Co-Authored-By: OpenAI Codex <openai-codex@users.noreply.github.com>
Do not treat a positive legacy count as ownership proof after a cleared
aggregate's final cell has left. Check live owner identities first, then keep
the cached root proof for unmigrated ownership paths.

Add a regression for final nested untracked-cell cleanup with a stale positive
compatibility count.

Generated with [Codex](https://openai.com/codex)

Co-Authored-By: OpenAI Codex <openai-codex@users.noreply.github.com>
Record full HTML-Tree, controller, WebSocket, and growing-output results on both backends after the cleared-aggregate owner-identity change.

Generated with [Codex](https://openai.com/codex)

Co-Authored-By: OpenAI Codex <openai-codex@users.noreply.github.com>
Record weak, destructor, resurrection, and cycle fixture results after the cleared-aggregate owner-identity fix.

Generated with [Codex](https://openai.com/codex)

Co-Authored-By: OpenAI Codex <openai-codex@users.noreply.github.com>
Track queued owner-release tokens until their deferred count transition
completes. Cleared-aggregate scope cleanup now leaves those transitions to
the release queue instead of finalizing early after the active slot is retired.
Add coverage for the queued counted-owner path and document the synthetic
legacy-count invariant separately.

Generated with [Codex](https://openai.com/codex)

Co-Authored-By: OpenAI Codex <openai-codex@users.noreply.github.com>
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