镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

GC: retire and destroy precise sibling realms safely #419

Closed

Description

@chrisbbreuer

Parent: #415
Depends on: #420, #421
GC parent: #144
Roadmap: #134

Complete the engine-core sibling lifecycle before #416 adopts it at the private ABI boundary.

Acceptance:

  • Stop realm jobs, timers, waiters, and threads before root retirement.
  • Remove the realm from the live root set atomically, run a synchronous full collection, and drain its deferred finalizers.
  • Release non-cell realm state and arena storage only after no owned cell can reference it.
  • Keep the heap owner alive until every sibling is retired and reject premature owner destruction.
  • Prove retained handles, shared Symbol identity, sibling reachability, exact finalization, relocation, and terminal teardown in Debug, ReleaseSafe, and TSan.

Activity

  1. chrisbbreuer commented on Jul 21, 2026

    @chrisbbreuer
    MemberAuthor

    Completed on main by 34762f8, building on #420/#421.

    Implemented:

    • a real createSharedPreciseRealm engine-core constructor with an independent non-cell arena, one shared precise heap/JIT, stable realm ID, failure-atomic bootstrap promotion, and VM-wide Symbol registry identity;
    • terminal retirement that rejects active interpreters/threads, stops terminal work, cancels timers, drops job/waiter/handle roots, atomically retires the realm, performs a synchronous full collection, drains deferred callbacks, and releases non-cell state only after hasRealmCells is false;
    • retryable RealmCellsRemain behavior when an owner-realm protected handle still reaches sibling cells;
    • an early all-build owner-destruction trap before any heap mutation while a live/bootstrapping/retiring sibling remains;
    • owner-only compaction with every live sibling quiescent.

    Focused evidence exercises distinct globals/arenas, shared Symbol identity, protected-handle relocation, compaction refusal with sibling jobs, cross-realm reachability, exact finalizer accounting, one-shot external callback delivery, retryable retirement, and terminal teardown. Results: Debug 3/3, ReleaseSafe 3/3, TSan 3/3; all zero leaks.

  2. chrisbbreuer commented on Jul 21, 2026

    @chrisbbreuer
    MemberAuthor

    All acceptance items are implemented and checked; private ABI adoption continues in #416.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions