ReviewOS

zig-utils/zig-js

ABI: implement process initialization and shell-timeout trap

#417
Closed chris opened this 10 days ago ·
10 days ago

Parent: #140 Profiles: #163, #164 Roadmap: #134 Pinned consumer: oven-sh/bun@4982b91e3702094330f3be3883354c52b8c01323 Pinned references: src/jsc/bindings/ZigGlobalObject.cpp:JSCInitialize, src/jsc/bindings/bindings.cpp:JSC__VM__notifyNeedShellTimeoutCheck

Implement the remaining private process-initialization boundary and the distinct shell-timeout VM trap as real engine state, not inert compatibility exports.

Acceptance:

  • Implement thread-safe, exactly-once JSCInitialize(env, count, callback, eval_mode, one_shot_startup) with first-call-wins configuration.
  • Inspect exactly count nullable sentinel-terminated C-string slots (the pinned ABI precondition), parse BUN_JSC_ entries, and report every unsupported/invalid option through the exact callback slice.
  • Apply supported JIT, WebAssembly, SharedArrayBuffer, and ShadowRealm policy to subsequent private VMs; retain eval/one-shot process policy, whose concurrent optimizing-JIT/GC-helper effects are vacuous in zig-js, while explicit specialized context options remain authoritative.
  • Make repeated and concurrent initialization calls inert after the winner, without retaining caller memory or invoking later callbacks.
  • Implement JSC__VM__notifyNeedShellTimeoutCheck as a thread-safe trap distinct from termination, watchdog, and debugger-break state; consume it at the next execution checkpoint.
  • Define the pinned private ABI handle contract: null is inert, each valid live VM targets only its own group, and foreign/stale non-null pointers remain caller UB like the upstream raw-pointer ABI.
  • Add independent Home/Bun ABI fixtures plus focused Debug, ReleaseSafe, and TSan coverage.
  • Pin exact source/semantic contracts, promote both symbols in both inventories, refresh concise docs/README counts, and reconcile exact main CI.
10 days ago

Implementation is on main in 54298a8 and evidence/docs/CI in 938ef0f. Both exact consumer executables pass in Debug, ReleaseSafe, and TSan. The process fixture covers first-call publication, four blocked concurrent followers, winning-thread reentry, null environment slots, two invalid entries with exact callback slices, later-callback suppression, disabled globals, VM-local one-shot shell-trap consumption, and null notification. Inventories are Home 446/471 and Bun 437/461 with zero unclassified entries. Closure remains gated only on exact main run 29794916349.

10 days ago

The first exact run compiled the new focused fixtures but found three older unit-only CContextGroup literals that did not initialize the newly required process-policy snapshot. Fixed narrowly in 341f387; the filtered unit compile passes 3/3 with zero leaks. Replacement exact main run: https://github.com/zig-utils/zig-js/actions/runs/29795137428.

10 days ago

Complete. Process initialization and the distinct shell-timeout trap are pinned, implemented, inventoried, documented, and independently exercised for Home/Bun in Debug, ReleaseSafe, and TSan. Exact main run 29801586207 passed all 43 jobs.

Sign in to comment on this issue.