ReviewOS

zig-utils/zig-js

ABI: implement exact private JSCell and JSString bridge

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

Parents: #163, #164 Depends on: #166, #172

Implement the shared opaque JSCell/JSString operations on the context-owned JSC64 handle boundary.

Acceptance:

  • Export exact JSC__JSValue__asString, JSC__JSString__eql, JSC__JSString__is8Bit, JSC__JSString__length, JSC__JSString__toObject, JSC__JSCell__getObject, and JSC__JSCell__toObject signatures.
  • Downcast only real context-owned string cells and reject immediates/non-strings safely.
  • Report JavaScript UTF-16 code-unit length exactly for ASCII, Latin-1, BMP, astral, and lone-surrogate/WTF-8 strings.
  • Match JSC 8-bit string eligibility and value equality across distinct string cells.
  • Return objects only for actual object cells from getObject; box String/Symbol/BigInt cells correctly through toObject and preserve object identity.
  • Reject foreign-context coercion safely.
  • Cover all signatures and semantic boundaries in the compile-link-runtime fixture.
  • Update both inventories and README/API documentation without changing public/extension counts.

String iteration and ZigString/Bun.String output layouts remain separate follow-up work.

9 days ago

Completed on main in 379ed5d; documentation followed in 70b2a2e.

Evidence:

  • all 7/7 exact symbols link and run through the pinned consumer fixture;
  • string downcast rejects immediates and ordinary objects;
  • length/storage cases cover ASCII, Latin-1, BMP, astral, and lone-surrogate WTF-8 strings;
  • distinct cells with equal content compare equal;
  • getObject preserves ordinary-object identity and rejects String/Symbol/BigInt primitive cells;
  • toObject boxes all three primitive-cell kinds, preserves actual object identity, and rejects a foreign context;
  • zig build test-home-private-abi reports 21/21 linked runtime symbols;
  • audits report Home 23/432, Bun core 23/422, public 117, extensions 19.

Sign in to comment on this issue.