ReviewOS

zig-utils/zig-js

ABI: implement private ordinary-object creation and primitive unboxing

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

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

Implement the shared ordinary-object construction and JSON-style boxed-primitive unwrapping boundary.

Acceptance:

  • Export exact JSC__JSValue__createEmptyObject, JSC__JSValue__createEmptyObjectWithNullPrototype, and JSC__JSValue__unwrapBoxedPrimitive signatures.
  • Create fresh ordinary objects with the selected realm Object.prototype; treat initial capacity strictly as an unobservable allocation hint.
  • Create fresh objects with a true null prototype.
  • Unwrap Number, String, Boolean, and BigInt wrapper objects to exact JSC64 primitives, including int32 canonicalization and negative-zero preservation.
  • Leave non-wrapper objects and already-primitive values unchanged.
  • Reject invalid/foreign-context inputs safely.
  • Cover exact signatures, prototype identity, freshness, wrapper kinds, and numeric boundaries in the compile-link-runtime fixture.
  • Update both inventories and README/API documentation without changing public/extension counts.
9 days ago

Completed on main in 06ec44c; documentation followed in 1c4f5ec.

Evidence:

  • all 3/3 exact symbols link through the pinned fixture;
  • ordinary constructors are fresh and share the selected realm Object.prototype even when a large capacity hint is supplied;
  • the null-prototype constructor returns a true null prototype;
  • Number unwrapping covers int32 minimum/maximum, the first out-of-range double, negative zero, and NaN;
  • String, Boolean, and BigInt wrappers return exact primitive values;
  • ordinary objects and existing primitives retain identity/encoding;
  • foreign-context wrapper input returns the empty sentinel;
  • zig build test-home-private-abi reports 24/24 linked runtime symbols;
  • audits report Home 26/432, Bun core 26/422, public 117, extensions 19.

Sign in to comment on this issue.