Skip to content

ABI: bridge private Promise reactions to JSHostFn callbacks #253

Description

@chrisbbreuer

Parent: #140
Profiles: #163, #164
Roadmap: #134

Implement the exact Home/Bun private-JSC Promise reaction bridge exported as JSC__JSValue___then.

Acceptance:

  • Accept native JSPromise values from either supported realm in the same VM and ignore non-Promise values without invoking callbacks.
  • Register distinct fulfillment and rejection JSHostFn callbacks through the engine's native Promise reaction queue.
  • Invoke the selected callback exactly once with a JSC64 CallFrame containing settlement value as argument 0 and the retained context JSValue as argument 1.
  • Preserve asynchronous FIFO microtask ordering for already-settled and later-settled promises; never invoke inline.
  • Keep callback functions, context values, source promises, and queued arguments alive through GC until delivery, then release reaction storage normally.
  • Preserve sibling-realm behavior, reentrant callback behavior, pending-exception boundaries, and exact no-op behavior for non-Promise inputs.
  • Add the export to both pinned inventories, the compiled consumer link/runtime fixture, API/ABI docs, and README evidence.
  • Regenerate both audits with zero unclassified entries and publish exact counts before closing.

Bun__attachAsyncStackFromPromise is intentionally separate: it reconstructs generator/await stack metadata rather than registering Promise reactions.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions