Skip to content

Implement private async-context call ABI #373

Description

@chrisbbreuer

Parent: #134

Implements the coherent async-context call boundary shared by the pinned Home and Bun inventories. This is a child of the private ABI coverage work tracked by #140, #163, and #164.

Scope

  • AsyncContextFrame__withAsyncContextIfNeeded
  • Bun__JSValue__isAsyncContextFrame
  • Bun__JSValue__call

Bake__getAsyncLocalStorage is intentionally out of scope: upstream exposes a separately stored Bake/dev-server ALS instance, not the currently active async-context value captured by these wrappers.

Acceptance

  • Add a realm-local active async-context value as a precise traced and relocated GC root.
  • Represent an AsyncContextFrame as a branded, non-callable object with strong callback and captured-context edges.
  • Return callbacks unchanged when no context is active and avoid double-wrapping existing frames.
  • Invoke plain callbacks and wrapped callbacks with exact argument ordering and global-this fallback for an empty receiver.
  • Install the captured context for the dynamic extent of the call and restore the prior context before normal return or exception publication.
  • Reject invalid/foreign handles without crossing VM ownership boundaries.
  • Cover brand, capture, nested restoration, throw restoration, GC retention/relocation, and compiled Home/Bun consumer signatures.
  • Refresh generated ABI inventories and coverage documentation, batch Debug/ReleaseSafe verification, then close this issue only after the pushed main commit is green.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions