Skip to content

ABI: expose revalidated contiguous JSArray vectors #255

Description

@chrisbbreuer

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

Implement the paired private array fast-path exports Bun__JSArray__getContiguousVector and Bun__JSArray__contiguousVectorIsStillValid.

Acceptance:

  • Return a stable read-only JSC64 EncodedJSValue vector and exact u32 public length only for real packed dense arrays with a prototype chain safe for direct indexed access.
  • Reject immediates, ordinary objects, proxies, typed arrays, holes/sparse tails, indexed accessors/descriptors, and prototype-index interception without modifying the output length.
  • Encode primitive and cell elements exactly, including same-VM sibling values; reject empty/undecided and all-double storage.
  • Revalidate array identity, expected vector identity, public length, dense shape, backing identity, and element snapshot before every fast read.
  • Invalidate safely after value replacement, push/pop/length changes, holes, storage replacement/reallocation, accessors, or prototype pollution so the consumer falls back to ordinary indexed Get.
  • Keep multiple simultaneous iterator vectors independently valid until their own observed storage changes; reject mismatched arrays, pointers, and lengths.
  • Cover GC, sibling realms, mutation/reallocation, inherited indexed getters, holes/undefined distinction, invalid pointers, and pending-exception neutrality.
  • Add both exports to the Home/Bun inventories and compiled fixture, update API/ABI docs and README evidence, and publish zero-unclassified audit counts.

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