ReviewOS

zig-utils/zig-js

ABI: implement private VM pending exceptions

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

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

Implement the shared private VM pending-exception and exception-cell foundation.

Acceptance:

  • Export exact JSC__JSGlobalObject__vm, JSC__VM__throwError, JSGlobalObject__hasException, JSGlobalObject__clearException, and JSGlobalObject__tryTakeException signatures.
  • Export exact JSC__Exception__asJSValue, JSC__JSValue__isException, JSC__JSValue__toError_, and JSC__JSValue__isAnyError signatures.
  • Model one pending exception per shared VM/context group, observable and clearable from every realm.
  • Represent pending exceptions as distinct owned cells with stable identity while preserving arbitrary thrown values, including primitives.
  • Preserve the first pending exception and reject mismatched VM/global/value ownership safely.
  • Make toError_ return ErrorInstance values unchanged and unwrap Exception cells to their thrown values.
  • Cover exact signatures, sibling-realm visibility, cell identity, primitive/Error throws, take/clear lifecycle, and invalid inputs in the compile-link-runtime fixture.
  • Keep termination-specific clearing and stack-trace extraction pending until their separate contracts are implemented.
  • Update both inventories and README/API documentation without changing public/extension counts.
9 days ago

Implemented and documented on main.

Evidence:

  • implementation: 7b6d9aee (feat(abi): add VM pending exceptions)
  • published ABI/README evidence: f91d90ca
  • Home inventory: 47/432 implemented after the combined slice
  • Bun core inventory: 47/422 implemented after the combined slice
  • focused private runtime fixture: 45/45 linked and passed after #181 exercised the exception boundary through thrown indexed getters
  • audits: public C 117/117, 19 extensions, 47 private exports; Bun private inventory has zero drift

Termination-specific clearing and stack-trace extraction remain outside this completed foundation as specified.

Sign in to comment on this issue.