Skip to content

ABI: implement ArrayBuffer copy and allocator ownership #369

Description

@chrisbbreuer

Parent: #134
Related: #140, #163, #164

Implement the shared JavaScriptCore-compatible private ArrayBuffer allocation, copying, and default-allocator ownership boundary used by the pinned Home and Bun consumers. These four exports share backing-store lifetime and failure semantics and should land as one coherent slice.

Acceptance:

  • Export Bun__createArrayBufferForCopy with a true fixed-length ArrayBuffer, byte-for-byte copy semantics, empty-buffer behavior, and pending OOM publication.
  • Export Bun__allocUint8ArrayForCopy with an uninitialized Uint8Array backing and publish the writable pointer only after successful construction.
  • Export Bun__allocArrayBufferForCopy with the pinned Buffer-subclassed Uint8Array result (despite its historical name), uninitialized backing, and success-only pointer publication.
  • Export JSArrayBuffer__fromDefaultAllocator as a no-copy ArrayBuffer adoption boundary that releases non-empty mimalloc/default-allocator storage exactly once and does not adopt the zero-length sentinel.
  • Preserve VM affinity, invalid-context safety, pointer identity for adopted storage, and empty/oversized failure behavior.
  • Add focused engine tests plus compiled Home/Bun consumer coverage in Debug and ReleaseSafe.
  • Refresh both generated private-ABI inventories and update the parent issues with exact evidence.

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