Skip to content

ABI: import ArrayBuffer values from shared memfd mappings #256

Description

@chrisbbreuer

Parent: #140
Tracked by: #134, #163, #164

Implement the pinned private ArrayBuffer__fromSharedMemfd boundary as a directly testable ownership slice, separately from the opaque native JSC::ArrayBuffer handle API.

Acceptance

  • Match the pinned C ABI and selected Home/Bun JSType tags for ArrayBuffer and Uint8Array results.
  • Validate the file descriptor, total mapping size, and requested byte range without overflow or partial ownership.
  • Create a private read/write mapping of the complete declared region, expose the requested slice without copying, and never close or otherwise take ownership of the caller file descriptor.
  • Return an exact ordinary ArrayBuffer or Uint8Array; reject every other requested type and every invalid or unsupported mapping cleanly.
  • Unmap the complete original mapping exactly once on collection or context teardown, including construction-failure paths.
  • Prove slice identity and mutability, MAP_PRIVATE file isolation, non-zero offsets, invalid descriptors/ranges/types, GC, and teardown behavior with focused unit and compiled consumer tests.
  • Mark the export implemented in both pinned inventories, preserve zero unclassified entries, and update the README/private ABI evidence.

Non-goals

The opaque JSC__ArrayBuffer__ref, JSC__ArrayBuffer__deref, and JSC__ArrayBuffer__asBunArrayBuffer handle contract will be tracked as a separate child because it needs an explicit native handle producer and independent lifetime model.

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