ReviewOS

zig-utils/zig-js

ABI: expose revalidated contiguous JSArray vectors

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

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

Implement the paired private array fast-path exports Bun__JSArray__getContiguousVector and Bun__JSArray__contiguousVectorIsStillValid.

Acceptance:

  • Return a stable read-only JSC64 EncodedJSValue vector and exact u32 public length only for real packed dense arrays with a prototype chain safe for direct indexed access.
  • Reject immediates, ordinary objects, proxies, typed arrays, holes/sparse tails, indexed accessors/descriptors, and prototype-index interception without modifying the output length.
  • Encode primitive and cell elements exactly, including same-VM sibling values; reject empty/undecided and all-double storage.
  • Revalidate array identity, expected vector identity, public length, dense shape, backing identity, and element snapshot before every fast read.
  • Invalidate safely after value replacement, push/pop/length changes, holes, storage replacement/reallocation, accessors, or prototype pollution so the consumer falls back to ordinary indexed Get.
  • Keep multiple simultaneous iterator vectors independently valid until their own observed storage changes; reject mismatched arrays, pointers, and lengths.
  • Cover GC, sibling realms, mutation/reallocation, inherited indexed getters, holes/undefined distinction, invalid pointers, and pending-exception neutrality.
  • Add both exports to the Home/Bun inventories and compiled fixture, update API/ABI docs and README evidence, and publish zero-unclassified audit counts.
9 days ago

Implemented and published directly to main in two small commits:

  • 481f8ddc — runtime exports, stable VM-owned encoded snapshots, exact revalidation, fixture coverage, and Home/Bun inventory evidence
  • 779f7eff — README, API, Home integration, and ABI documentation

Focused evidence passes with 261/261 compiled private symbols, Home at 262/431 implemented (169 pending), Bun core at 256/421 implemented (165 pending), and zero unclassified declarations. The benchmark scores remain the current documented 1,540-sample results because this embedding-only ABI path is outside the benchmark workload.

Sign in to comment on this issue.