ReviewOS

zig-utils/zig-js

ABI: implement exact JSValue ArrayBuffer view projection

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

Parent: #134 Profile umbrella: #140 Home inventory: #163 Bun inventory: #164 Builds on: #215 through #218

Implement the pinned private-JSC export:

  • JSC__JSValue__asArrayBuffer

Acceptance criteria:

  • Accept live ArrayBuffer, every numeric TypedArray kind, and DataView values; reject primitives and unrelated objects without modifying the output.
  • Return the exact live data pointer, element length, byte length, original encoded value, and profile-selected private JSType tag.
  • TypedArray and DataView pointers include their byte offset into the backing store.
  • Report SharedArrayBuffer and resizable/growable metadata exactly.
  • Handle detached and out-of-bounds views without dereferencing stale storage, matching the pinned zero-length/null-vector behavior.
  • Reject foreign-VM cells and preserve an already-pending exception without replacing it.
  • Focused tests and the Home consumer fixture cover ArrayBuffer, all numeric view widths, DataView, offsets, empty/detached/resizable storage, invalid inputs, and Home/Bun tag selection.
  • Inventories, ABI docs, README scorecard, and parent trackers publish the verified counts; benchmark scores remain unchanged unless a benchmark path is rerun.

Completed evidence

Implemented on main in 1e42ae5f; documentation and pinned inventories were published in 2b0429b5. The 40-byte projection record now preserves the exact offset data pointer, logical element length, byte length, encoded value, profile-selected private JSType tag, and shared/resizable flags for ArrayBuffer, all 12 numeric TypedArray kinds, and DataView. Detached and out-of-bounds views produce the pinned null-vector/zero-length result; invalid and foreign-VM values leave output untouched, and pending exceptions are preserved.

Verification was intentionally batched: the focused unit test passed 3/3 with zero leaks; the combined test/profile/audit build passed 15/15; the Home consumer fixture linked and exercised 199/199 symbols; Home is 200/431 (231 pending), Bun core is 194/421 (227 pending), and the public audit reports 117 public, 19 extensions, and 204 private/support exports. Benchmark scores were not changed because no benchmark path was affected or rerun.

9 days ago

Completed on main in 1e42ae5f with the documentation/inventory evidence in 2b0429b5. All acceptance criteria are checked; the intentionally batched 15/15 verification, zero-leak focused run, 199/199 consumer fixture, and updated profile counts are recorded above.

Sign in to comment on this issue.