-
-
Couldn't load subscription status.
- Fork 1.5k
Lbcheng #25225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Lbcheng #25225
Conversation
…arc/orc Add ARC/ORC regression for async callSoon closures
…eration changes (nimTraceClosure, mandatory attachedTrace),
runtime support (TNimTypeV2, cyclebreaker.releaseGraph/thinout, lightweight nimTraceRef* stub), and async lifecycle fixes
(callSoon, consolidated leak tests, new stress suites).
- Published the verification matrix that was used to vet the new behavior (ARC/ORC runs, threaded scenarios, leak counters).
|
Most interesting. Can you give us more documentation please? |
|
sure, b395500 |
lib/system/orc.nim
Outdated
|
|
||
| proc unregisterCycle(s: Cell) = | ||
| # swap with the last element. O(1) | ||
| if s.rootIdx == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fishy. Why can this happen now that we support thinOut?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reviewing and comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thinOut only guarantees that the roots array is compact at the moment it runs.
During destructors or partial collections roots can be mutated again and the
cached rootIdx becomes stale (it can even drop to zero although the entry is
still present). With thinOut alone we can still reach unregisterCycle with an
invalid index. The fix recompacts roots on demand and rescans for the cell so
the removal is always correct.
Destructors and partial collects can reshuffle the ORC roots array, leaving
entries with rootIdx <= 0 even though the cell remains tracked. The old
unregisterCycle treated that as already-unlinked and leaked the root.
Add an internal compactRoots helper that recomputes indices, let
unregisterCycle revalidate its slot (falling back to a scan if thin-out moved
the cell), and only then swap it with the tail.
Tests: testament/testament --nim:bin/nim c arc "--mm:arc"
testament/testament --nim:bin/nim c arc "--mm:orc"
nim c --gc:orc -d:nimThinout -r tests/arc/thamming_thinout.nim
runtime support (TNimTypeV2, cyclebreaker.releaseGraph/thinout, lightweight nimTraceRef* stub), and async lifecycle fixes
(callSoon, consolidated leak tests, new stress suites).