ReviewOS

zig-utils/zig-js

ABI: own standalone VM lifecycle and GC deferral

#391
Closed chris opened this 9 days ago ·
9 days ago

Parent: #140 Profiles: #163, #164 Roadmap: #134

Implement the shared pinned VM ownership boundary as real zig-js semantics:

  • JSC__VM__create
  • JSC__VM__deinit
  • JSC__VM__deferGC
  • JSC__VM__setControlFlowProfiler

JSC__VM__notifyNeedShellTimeoutCheck remains outside this slice because it is jsc-shell-only timeout machinery with no zig-js shell state; its explicit rejection remains documented.

Acceptance:

  • Create a standalone, refcounted context-group VM for both pinned heap-type tags and fail safely on allocation failure.
  • Define exactly-once VM owner release without invalidating retained realms, and reject foreign-global misuse.
  • Defer every applicable zig-js collection entry point across nested callbacks, then preserve queued async collection intent after the outermost scope exits.
  • Store real per-VM control-flow-profiler state instead of a compatibility no-op.
  • Add lifecycle, realm-retention, nesting, callback, collection, misuse, and allocation-failure tests.
  • Add compiled Home/Bun consumer evidence in Debug and ReleaseSafe.
  • Refresh both exact inventories, #140/#163/#164, and concise ABI documentation.

Completion evidence:

  • VM implementation and exhaustive unit coverage: fd4cc8cd
  • Consumer fixtures, CI, and documentation: fabafb81
  • Focused engine slice: 6/6, zero failures/leaks
  • Home consumer: 388/388 symbols in Debug and ReleaseSafe
  • Bun VM lifecycle consumer: Debug and ReleaseSafe
  • Current inventories: Home 408/471 (63 pending), Bun 400/461 (61 pending), zero unclassified
  • Release matrix derives 124 remaining private imports.
9 days ago

Completed in a84af344 and a9b4d5b5. The four shared VM imports now have owned lifecycle, exact nested GC deferral, real profiler state, exhaustive allocation rollback, and Debug/ReleaseSafe Home+Bun consumer evidence. Inventories are Home 408/471 and Bun 400/461 with zero unclassified.

9 days ago

Post-rebase commit IDs: implementation fd4cc8cd, consumer/CI/docs fabafb81.

Sign in to comment on this issue.