Skip to content

docs(refcount): rename "cooperative" → "selective"; new memory-management.md#634

Merged
fglock merged 1 commit intomasterfrom
docs/selective-refcount-and-memory-management
Apr 30, 2026
Merged

docs(refcount): rename "cooperative" → "selective"; new memory-management.md#634
fglock merged 1 commit intomasterfrom
docs/selective-refcount-and-memory-management

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Apr 30, 2026

Summary

  • Rename "cooperative reference-counting overlay" → "selective reference-counting overlay" project-wide. The original term has no presence in the GC literature; "selective" accurately captures the defining property (refcount is opt-in per object class, only for those needing DESTROY / weaken semantics).
  • New docs/reference/memory-management.md — user-facing summary of the selective refcount overlay, with verified links to the GC literature (Bacon 2004, Blackburn & McKinley 2003, The Garbage Collection Handbook, Wikipedia, JDK java.lang.ref, perlobj).
  • Replace the inline DESTROY section in docs/reference/architecture.md with a brief pointer to the new doc.
  • Update dev/architecture/weaken-destroy.md to reflect the property-based walker gate (D-W6.18) and activeOwners / reachableOwnerCount infrastructure that landed in PR fix: replace class-name walker-gate heuristic with property-based gate #618.

Why "selective" instead of "cooperative"

The new doc has a "Where this fits in the GC literature" section that explains the choice. In the Bacon/Cheng/Rajan framing, hybrid collectors partition the heap and apply tracing to one part and reference counting to the other; PerlOnJava picks the partition along a per-class behavioural boundary (does this class need finalization or weak-ref semantics that the JVM cannot already provide?). That's "selective" — not "deferred" (a write-barrier optimisation) and not "ulterior" (a generational boundary).

Scope of the rename

86 occurrences across 32 files:

  • All user-facing docs (docs/, AGENTS.md, jperl scripts)
  • All dev/ design notes and module-level docs
  • Source comments in src/main/java/.../runtimetypes/*.java and operators/*.java
  • B.pm and Class/MOP/Method/Accessor.pm

Skipped:

  • Bundled upstream Perl/CPAN docs (perlthrtut.pod, Moose cookbook — different sense of "cooperative")
  • PublicSuffix.pm ("KPMG International Cooperative" company name)
  • build/, target/, cpan_build_dir/
  • "cooperatively" (different word ending, different meaning)

Test plan

  • make (full build + all unit tests) passes
  • make check-links (lychee --offline) — 267 OK, 0 errors
  • All 8 external literature URLs verified with curl (HTTP 200 or valid 302 redirect)
  • Java compiles cleanly (no comments accidentally rebroken by the rename)
  • No leftover cooperative matches remain in any code or doc that should have been renamed (rg -i '\bcooperative\b' shows only the intentionally-skipped files)

Generated with Devin

…ment.md

The phrase "cooperative reference-counting overlay" was project-internal
vocabulary with no presence in the GC literature. Renamed to "selective
reference-counting overlay" throughout — "selective" accurately captures
the design's defining property (refcount tracking is opt-in per object
class, only for those needing DESTROY / weaken semantics) and is
descriptive in standard GC terminology.

Project-wide rename (~86 occurrences across 32 files):
- All user-facing docs (docs/, AGENTS.md, jperl scripts)
- All dev/ design and module notes
- Source comments in src/main/java/.../runtimetypes/* and operators/*
- B.pm and Class/MOP/Method/Accessor.pm Perl modules
- Skipped: bundled CPAN/Perl docs (perlthrtut.pod, Moose cookbook),
  TLD list (PublicSuffix.pm "KPMG International Cooperative"),
  build/target/cpan_build_dir, "cooperatively" (different word).

New docs/reference/memory-management.md:
- User-facing summary of the selective refcount overlay (no project
  history — that lives in dev/architecture/weaken-destroy.md and
  dev/modules/moose_support.md).
- "How the overlay works" mechanism table.
- "Where this fits in the GC literature" section with verified links:
  - The Garbage Collection Handbook (Jones, Hosking, Moss)
  - Bacon, Cheng, Rajan 2004 "A Unified Theory of Garbage Collection"
  - Blackburn & McKinley 2003 "Ulterior Reference Counting"
  - Wikipedia: Reference counting / Tracing GC / Garbage collection /
    Finalizer
  - Java java.lang.ref package summary (JDK 21)
  - perldoc.perl.org perlobj#Destructors
- Explains why "selective" rather than "deferred" or "ulterior" — the
  partition criterion is per-class behavioural (does this need
  finalization?), not generational or write-barrier-based.
- Comparison table: Perl 5 vs JVM finalization vs PerlOnJava.

docs/reference/architecture.md:
- Replaced inline 14-line DESTROY section with a 4-line pointer to
  the new memory-management.md.
- Added memory-management.md to "Related Documentation" list.

dev/architecture/weaken-destroy.md (separate prior work in this branch):
- Updated to reflect property-based walker gate (D-W6.18) replacing
  the class-name heuristic (Class::MOP/Moose/Moo allowlist).
- Documented MortalList.flush()'s narrow auto-trigger
  (storedInPackageGlobal + hasWeakRefsTo) and its per-flush
  reachable-set cache.
- Added section 10b on RuntimeBase.activeOwners /
  reachableOwnerCount infrastructure (D-W6.14 / D-W6.16).
- Documented PJ_REFCOUNT_TRACE / PJ_WEAKCLEAR_TRACE / PJ_DESTROY_TRACE.

Verification:
- `make` passes (build + all unit tests).
- `make check-links` passes (267/267 internal links OK).
- All 8 external literature URLs verified with curl (HTTP 200 / valid
  302 redirects to ACM for DOIs).

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@fglock fglock force-pushed the docs/selective-refcount-and-memory-management branch from 46274a4 to 220a157 Compare April 30, 2026 08:34
@fglock fglock merged commit 0128aa7 into master Apr 30, 2026
2 checks passed
@fglock fglock deleted the docs/selective-refcount-and-memory-management branch April 30, 2026 08:34
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