Skip to content

ABI: create callable JSFunctions from Zig host functions #248

Description

@chrisbbreuer

Goal

Implement the pinned Home/Bun private-JSC JSFunction__createFromZig boundary with the exact BunString, JSHostFn, CallFrame, visibility, intrinsic, arity, and optional constructor contracts.

Parent tracking: #134, #140, #163, #164.

Required behavior

  • Decode the by-value 24-byte BunString name without retaining borrowed input.
  • Create a callable function in the requested realm with stable name and length.
  • Invoke the supplied JSHostFn through the pinned JSC64 CallFrame register layout (callee, argument count including this, receiver/new.target, arguments).
  • Translate returned EncodedJSValue values and pending exceptions exactly at the VM boundary.
  • Support an explicit constructor callback and the upstream default host-constructor path.
  • Validate null/foreign/invalid values, pending-exception preservation, sibling realms, and GC rooting.
  • Promote both pinned inventories and consumer evidence, then update README/docs.

Evidence gate

  • Home private ABI audit: 249/431 implemented, 182 pending, zero unclassified.
  • Bun private ABI audit: 243/421 implemented, 178 pending, zero unclassified.
  • Compiled Home consumer fixture: 248/248, including call, construct, sibling-realm, GC, and failure paths.
  • Targeted test-home-private-abi and test-c-api gates pass.
  • Benchmark artifact remains 36a617b3; this ABI-only slice does not alter the benchmark workload.

Implementation: d2a653b. Documentation: 515f058.

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