ReviewOS

zig-utils/zig-js

ABI: implement private C-API call and proxy extensions

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

Parent: #134 Related: #140, #163, #164

Implement the two shared private extensions declared by pinned Home/Bun javascript_core_c_api.zig.

Acceptance:

  • Export JSObjectCallAsFunctionReturnValueHoldingAPILock with exact C signature, recursive VM API-lock coverage, default-global this, ordered argument conversion, and normal encoded return values.
  • Convert a thrown call into an encoded exception cell returned to the caller without leaking it into the VM pending-exception slot.
  • Return empty for null, non-callable, foreign-VM, or otherwise invalid values without publishing partial results.
  • Export JSObjectGetProxyTarget as a pure trap-free direct target projection; return null for non-proxies, revoked proxies, non-value private handles, and null inputs. As in JSC, dereferencing a handle after its entire context group is destroyed is outside the C API lifetime contract.
  • Preserve same-VM identity/lifetime and avoid invoking proxy traps.
  • Add focused engine and compiled Home/Bun consumer evidence in Debug and ReleaseSafe.
  • Refresh inventories/docs and parent issue evidence.
9 days ago

Completed in 930f177b and pushed directly to main.

Evidence:

  • exact Home/Bun C signatures exported for the API-lock call wrapper and proxy target projection;
  • recursive lock behavior is observed both when nested under an existing lock and from a native callback at lock depth 1;
  • default-global this, ordered arguments, encoded normal returns, exception-cell returns, and an empty VM pending-exception slot are covered;
  • null/non-callable and foreign function/receiver/argument values fail empty;
  • proxy target identity is strict-equal, trap count remains zero, and non-proxy/revoked/non-value/null inputs return null;
  • focused engine test: 3/3 pass, zero skips/failures/leaks in Debug and ReleaseSafe;
  • pinned Home consumer: 348/348 symbols linked and runtime matrix passed in Debug and ReleaseSafe;
  • dedicated pinned Bun consumer passes in Debug and ReleaseSafe;
  • inventory audits: Home 361/471 implemented (110 pending), Bun 353/461 (108 pending), zero unclassified;
  • ABI parser unit tests: 4/4 pass;
  • CI now runs the dedicated Bun fixture, and ABI/API/Home integration docs carry the new counts and semantics.

The root README benchmark block is unchanged because this ABI slice does not affect or regenerate benchmark results.

Sign in to comment on this issue.