ReviewOS

zig-utils/zig-js

ABI: generate and own deterministic cached bytecode artifacts

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

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

Implement the three shared Home/Bun CachedBytecode.zig imports as one exact ownership boundary:

  • generateCachedModuleByteCodeFromSourceCode
  • generateCachedCommonJSProgramByteCodeFromSourceCode
  • CachedBytecode__deref

Acceptance:

  • Implement the exact pinned signatures and explicit opaque-handle ownership.
  • Define a versioned, endian-stable artifact with source kind, URL, source payload, lengths, and integrity digest.
  • Validate ESM/CommonJS syntax through the production parser before publishing bytes.
  • Keep all out-parameters cleared on failure and tolerate null/empty URL strings according to the pinned BunString ABI.
  • Add allocation-failure, invalid-source, determinism, kind-separation, lifetime, and concurrent-generation tests.
  • Add compiled Home/Bun consumer evidence in Debug and ReleaseSafe.
  • Refresh both exact inventories, #140/#163/#164, and concise ABI documentation.

Completion evidence:

  • Implementation, exact consumers, inventories, CI, and docs: 4c1b2873
  • Allocation rollback and concurrency/TSan hardening: 367a3df5
  • Focused unit slice: 6/6, zero failures/leaks
  • Concurrent-generation TSan slice: 3/3, zero failures/leaks/races
  • Home compiled consumer: 388/388 symbols in Debug and ReleaseSafe
  • Dedicated Bun compiled consumer: Debug and ReleaseSafe
  • Current inventories: Home 404/471 (67 pending), Bun 396/461 (65 pending), zero unclassified
9 days ago

Completed on main. The pinned allocator-vtable lifetime now owns a deterministic, syntax-validated ZJSCBC01 artifact without misrepresenting it as JavaScriptCore private serialization; failure paths are atomic and concurrent generation is TSan-clean.

Sign in to comment on this issue.