ReviewOS

zig-utils/zig-js

ABI: implement exact private BigInt cell ordering bridge

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

Parents: #163, #164 Depends on: #170

Expose the shared opaque JSBigInt cell operations while reusing zig-js exact arbitrary-precision comparison machinery.

Acceptance:

  • Export exact JSC__JSBigInt__fromJS, JSC__JSBigInt__orderDouble, JSC__JSBigInt__orderInt64, JSC__JSBigInt__orderUint64, and JSC__JSBigInt__toInt64 signatures.
  • Downcast only real context-owned BigInt cells and reject other JSC64 values safely.
  • Compare arbitrary-size positive and negative BigInts exactly against all i64/u64 boundaries.
  • Compare exactly against finite fractional/integral/subnormal/extreme f64 values and infinities without lossy BigInt-to-double rounding.
  • Match JSC signed modulo-2^64 extraction.
  • Cover exact signatures and semantic boundaries in the compile-link-runtime fixture.
  • Update both inventories and README/API documentation without changing public/extension counts.

JSC__JSBigInt__toString is intentionally excluded until the pinned Bun/Home string-return layout is implemented.

9 days ago

Completed on main in f18d0d7; documentation followed in 0b81e97.

Evidence:

  • exact 5/5 opaque BigInt signatures link through the pinned consumer fixture;
  • downcast rejects immediates, strings, and empty values;
  • integer ordering covers i64/u64 limits plus arbitrary positive/negative values beyond i128;
  • double ordering stays exact at 2^53+1, positive/negative fractions, minimum subnormal, both infinities, and 10^400 versus floatMax;
  • signed extraction covers i64 minimum, -1, u64 maximum, and an arbitrary-size modulo result;
  • zig build test-home-private-abi reports 14/14 value/BigInt symbols passing;
  • audits report Home 16/432, Bun core 16/422, public 117, extensions 19.

Sign in to comment on this issue.