ReviewOS

zig-utils/zig-js

ABI: return owned BunString values for private BigInt conversion

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

Parent

Scope

Implement the pinned shared JSC__JSBigInt__toString private ABI exactly enough for Bun/Home consumers:

  • mirror the 64-bit 24-byte BunString tagged-union layout and exact tag values;
  • return an owned, Latin-1 WTFStringImpl-tagged decimal result;
  • provide compatible atomic ref/deref ownership for the returned string storage;
  • preserve pending-exception and out-of-memory boundary behavior;
  • cover signed, oversized, ownership, layout, and cross-realm cases in the focused ABI fixture;
  • update both pinned inventories, ABI docs, roadmap progress, and README.

The pinned Bun implementation is src/jsc/bindings/JSBigIntBinding.cpp at 4982b91e; Home declares the same by-value ABI at 7ed99c02.

Acceptance

  • Exact layout/tag/refcount contract is documented and compile-time asserted.
  • JSC__JSBigInt__toString returns owned decimal text for every supported BigInt magnitude.
  • Caller ref/deref behavior is safe and leak-free.
  • Focused Home private ABI fixture and both pinned audits pass.
  • README and parent issues carry current counts/evidence.

Evidence

Implemented in a216853e; documentation published in c944a3f5.

  • zig build test-home-private-abi -Doptimize=Debug: 80/80 combined symbols linked and runtime matrix passed.
  • zig build home-private-abi-audit bun-private-abi-audit: Home 82/431 implemented (349 pending); Bun 75/421 implemented (346 pending).
  • Runtime coverage includes exact 24-byte/8-byte layout, tag values, StringImpl prefix/8-bit flag, signed and arbitrary-size decimal output, fresh refcount-one allocations, atomic retain/release, cold Rust destroy compatibility, same-VM sibling realms, and first-pending-exception preservation.
9 days ago

Completed in two pushed mainline chunks:

  • a216853e — exact BunString/WTFStringImpl implementation, ownership helpers, inventories, and 80/80 focused runtime fixture.
  • c944a3f5 — README and integration/API evidence with current profile counts.

Verification passed:

  • zig build test-home-private-abi -Doptimize=Debug
  • zig build home-private-abi-audit bun-private-abi-audit

Current audited status: Home 82/431 implemented (349 pending); Bun 75/421 implemented (346 pending). Parent issues #134, #140, #163, and #164 are updated.

Sign in to comment on this issue.