Parent: #140 Tracks: #163, #164 Depends on: #180
Implement the coherent native Promise and aliased InternalPromise creation/downcast/wrapping slice shared by the pinned Home and Bun private-JSC profiles.
Exact ABI scope
JSC__AnyPromise__wrapJSC__JSPromise__createJSC__JSPromise__rejectedPromiseJSC__JSPromise__rejectedPromiseValueJSC__JSPromise__resolvedPromiseJSC__JSPromise__resolvedPromiseValueJSC__JSPromise__wrapJSC__JSValue__asInternalPromiseJSC__JSValue__asPromiseJSC__JSValue__createInternalPromise
Acceptance
- Create fresh pending promises in the selected global realm with the selected
Promise.prototype. - Treat
JSInternalPromiseas the pinned ABI alias ofJSPromise; both downcasts accept only live native Promise cells from any live VM and reject primitives, ordinary objects, exception cells, and empty values. - Make pointer-returning and encoded-value constructors preserve the exact promise cell/handle contract.
- Make resolved/rejected constructors store the exact supplied value directly without thenable assimilation; same-VM sibling values are accepted and foreign-VM values fail with a VM-shared TypeError.
- Match
JSPromise__wrap: consume callback exceptions into rejection, reject returned Error instances, pass through returned native promises unchanged, and directly fulfill ordinary callback results. - Match
AnyPromise__wrap: settle the supplied pending native promise, consume callback exceptions into rejection, reject returned Error instances, and use normal Promise resolution for ordinary results including thenable assimilation and self-resolution rejection. - Cover callback reentrancy, exception identity/clearing, value identity, realm/prototype selection, already-settled targets, and invalid handles in the combined compile-link-runtime fixture.
- Regenerate Home/Bun inventories, keep exact ABI verification green, update README/ABI documentation and parent issue evidence, and publish focused validation results.
JSC__JSValue___then and application-specific async/rejection notification hooks are intentionally outside this child because they require the separate host-function/reaction callback ABI rather than this creation and settlement boundary.