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

Runtime: keep single-owner realm roots off binding mutexes #598

Closed

Description

@chrisbbreuer

Parent: #479
Related: #478, #531, #532

Evidence

After #597 removes embedded-root GC owner classification, current production cold attribution still records 31,242 Environment binding-lock acquisitions during one representative configuration: 27,297 reads and 3,945 writes, of which 27,289 reads and 3,942 writes are on the Context-embedded root. The context is created with precise GC but no threads, parallel mutators, or concurrent marker; its root Environment is creator-thread-owned for its immutable lifetime.

The existing process-global binding_locks_enabled gate intentionally starts true because changing one global flag while another context holds a lock made paired lock/unlock unsafe. That history rules out toggling the global gate. It does not require every independent Environment to share one mutable policy.

Scope

  • Add an immutable per-Environment synchronization ruling, set before publication.
  • Keep root locking enabled for thread-enabled, parallel-GC/JS, and concurrent-marker contexts.
  • Allow only provably single-owner realm roots (including owner-thread-affine C API realms) to skip the mutex.
  • Retain the existing process-global fail-safe and all managed/captured/private-activation protocols.
  • Add creation-policy, parallel-context, concurrent-marker, and focused TSan witnesses.

Correctness constraints

  • No process-global disable, runtime false-to-true policy transition, GIL substitution, or benchmark-specific path.
  • Any Environment reachable by peer mutators or a concurrent marker must remain locked.
  • Context options are immutable; publication/revocation must not depend on later inference.
  • GC tracing, moving relocation, direct/indirect eval, modules, C API sibling realms, and teardown must remain exact.
  • Do not touch stacks, queues, jobs, Promise, microtask, or Worker lifecycle implementation.

Acceptance

  • Exact-parent production cold medians improve with identical checksum and allocation/execution counters.
  • Root Environment lock attribution falls to zero only for single-owner contexts and stays nonzero in shared/concurrent witnesses.
  • Relevant test262, focused TSan/GC/C API tests, and full units pass without leaks.

Activity

  1. chrisbbreuer commented on Aug 16, 2026

    @chrisbbreuer
    MemberAuthor

    Landed on main in 6c246bb6 (perf(runtime): elide single-owner root locks (#598)).

    The immutable per-Environment ruling is set before bootstrap/publication. Single-owner realm roots skip binding locks; thread-enabled, parallel-JS/GC, concurrent-marker, managed, and captured environments retain synchronization. No process-global gate transition or jobs/queues/Promise/Worker surface changed.

    Verified against exact parent 8e211b2f:

    • representative attribution: Environment acquisitions 31,242 → 11; root reads 27,289 → 0; root writes 3,942 → 0
    • allocation, GC-cell, execution-tier, shape, heap, and cell-slab inventories exact
    • 21 alternating cold samples: 13.008 ms → 12.948 ms (-0.46%), checksum 1 throughout
    • test262: 0 flips across global-code 42/42, eval-code 347/347, let 145/145, const 136/136
    • full units: 1,714 passed, 1 skipped, 0 failed, 0 leaked
    • focused normal + TSan shared-root, concurrent-trace, and C-API sibling-realm witnesses pass.
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