ReviewOS

zig-utils/zig-js

ABI: implement exact FFI 64-bit slow conversions

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

Parent: #140 Tracks: #163, #164 Depends on: #170, #175

Implement the two shared FFI slow-path symbols without conflating them with the separate low-level JSFunctionCall/CallFrame bridge in the same pinned source.

Exact scope:

  • JSVALUE_TO_INT64_SLOW
  • JSVALUE_TO_UINT64_SLOW

Acceptance:

  • Decode pinned JSC64 cell words through validated private handles rather than zig-js internal NaN-box bits.
  • Match JSC BigInt.asIntN/asUintN modulo-2^64 semantics for positive, negative, boundary, and arbitrary-size heap BigInts.
  • Preserve the pinned numeric fallback behavior for directly invoked int32/exact-number inputs while returning deterministic zero for invalid, nonnumeric, exception, empty, and deleted values.
  • Cover signed minimum/maximum, unsigned maximum, -1n, 2^64 wraparound, values beyond i128, and invalid cells in the combined compile-link-runtime fixture.
  • Regenerate both inventories, update README/API/ABI/Home evidence, and preserve public/extension accounting.
9 days ago

Implemented and documented on main in 70bca74 and 3d3175a. zig build test-home-private-abi -Doptimize=Debug reports Home 80/432 and passes the 78/78 combined fixture. Bun advances to 73/422. Coverage includes i64/u64 boundaries, -1n, modulo wraparound beyond i128, int32/exact-number fallbacks, and invalid cells. README/API/ABI/Home totals are current; benchmark scores remain unchanged because workloads are unaffected.

Sign in to comment on this issue.