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

Wasm: synchronize shared writes with relocating memory growth #425

Closed

Description

@chrisbbreuer

Roadmap: #134
GC parent: #144

Exact main run 29803416991 exposed a no-GIL TSan race between ordinary shared TypedArray writes and the copy performed by relocating WebAssembly Memory.grow. Relocating growth now observes shared bytes through synchronized semantics while preserving old aliases and leaving exclusive non-shared paths unchanged.

Acceptance

  • Define a per-memory synchronization contract without reintroducing the JS GIL.
  • Make relocation race-free while preserving exact contents and historical aliases.
  • Keep exclusive ArrayBuffer and Wasm memory paths unchanged.
  • Preserve detach, generation, and publication ordering.
  • Pass the focused overlap case repeatedly under TSan plus Debug and ReleaseSafe semantics.
  • Add a regression covering contents, lengths, historical aliases, and teardown.
  • Reconcile an unsuperseded exact main run.

Completed by 7ed9d280; exact-main run 29806223245 passed 43/43 jobs.

Activity

  1. chrisbbreuer commented on Jul 21, 2026

    @chrisbbreuer
    MemberAuthor

    Root fix pushed directly to main in 7ed9d280. Host-observed ordinary Wasm memory now asks the JS embedding to lock the current ArrayBuffer only around the old-to-fresh relocation copy. It unlocks before fresh-wrapper allocation/publication; the existing detach step reacquires the same buffer lock before the old slab is freed. Unrelated memories, shared non-moving slabs, and pure-Wasm/non-host growth retain their existing paths. Evidence on Zig 0.17.0-dev.1426: exact mc-grow-wasm-relocating-grow.js passes Debug (32.8 s), ReleaseSafe (0.17 s), and TSan (220.4 s); the new callback/publication unit passes Debug, ReleaseSafe, and TSan (3/3, zero leaks). Fresh exact main run is pending.

  2. chrisbbreuer commented on Jul 21, 2026

    @chrisbbreuer
    MemberAuthor

    Closed against exact main commit e3fdc52385204c75fe6ae5c64d48dae6e5ede418: Actions run 29806223245 completed successfully with all 43 jobs terminal and no failures.

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