Skip to content

ABI: implement exact internal length projection #223

Description

@chrisbbreuer

Parent: #134
Profile umbrella: #140
Home inventory: #163
Bun inventory: #164
Builds on: #222

Implement the pinned shared private-JSC export:

  • JSC__JSValue__getLengthIfPropertyExistsInternal

Acceptance criteria:

  • Return exact UTF-16 string length, Array logical length, every numeric TypedArray live length, and ArrayBuffer live byte length without observable property lookup.
  • Return internal Map, Set, and WeakMap sizes while ignoring spoofed own/prototype length properties.
  • Handle detached/out-of-bounds views and detached buffers with the pinned zero result.
  • For other JSObjects, perform exactly one ordinary length lookup and ToNumber conversion, including accessors, proxies, inherited values, and abrupt completion.
  • Return positive Infinity when a supported cell has no length, zero for non-cell/invalid/foreign inputs, and preserve the first pending VM exception.
  • Focused tests cover strings with astral/lone-surrogate units, sparse arrays, all view widths, buffers, collection kinds, spoofing, missing length, conversion hooks, exceptions, and VM ownership.
  • Extend the Home consumer fixture and publish exact Home/Bun inventory, ABI documentation, README, and parent counts.
  • Batch the focused test, consumer fixture, both private audits, and C-API classification before publishing.
  • Leave benchmark scores unchanged unless a benchmark path is rerun.

Completed evidence

Implemented on main in 70f91fa3; pinned inventories, ABI documentation, and README counts were published in 69a4206c. The type-directed projection now returns UTF-16 string length, Array logical length, numeric TypedArray live length, ArrayBuffer byte length, and internal Map/Set/WeakMap sizes without observable property reads. Other objects perform exactly one ordinary length lookup plus ToNumber; detached storage, missing values, unsupported cells, foreign inputs, proxies, accessors, conversion hooks, and abrupt completion follow the pinned result matrix.

The intentionally batched verification passed 15/15: focused tests passed 3/3 with zero leaks, the Home fixture linked and exercised 204/204 symbols, Home is 205/431 (226 pending), Bun core is 199/421 (222 pending), and the public audit reports 117 public, 19 extensions, and 209 private/support exports. Benchmark scores remain unchanged because no benchmark path was affected or rerun.

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