镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

ABI: implement exact iterable callback traversal #237

Closed

Description

@chrisbbreuer

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

Implement the pinned JSC__JSValue__forEach private-ABI boundary as a real iterator-protocol traversal with a native callback per yielded value.

Acceptance

  • Perform exact GetMethod(value, @@iterator), iterator creation, cached next lookup, IteratorStep, and IteratorValue ordering for arrays, strings, Map/Set, generators, and custom iterables.
  • Invoke the native callback once per yielded value with the selected global, VM identity, opaque callback context, and stable EncodedJSValue identity.
  • Preserve getter/proxy/custom-iterator observability and stop on abrupt completion; close an open iterator when the callback publishes an exception, retaining the original first-wins exception if return() also throws.
  • Accept same-VM sibling values, reject foreign-VM handles, and leave an already-pending exception untouched without advancing the iterable.
  • Add focused normal/leak coverage and the pinned consumer compile-link-runtime fixture.
  • Update generated Home/Bun inventories, README/docs counts, and all parent issue evidence from committed artifacts.

Activity

  1. chrisbbreuer commented on Jul 17, 2026

    @chrisbbreuer
    MemberAuthor

    Completed on main in two small commits: implementation and focused/consumer coverage at 815bbb87, then generated inventories and README/docs evidence at 839b4743.

    Evidence:

    • exact @@iterator lookup/call, cached next, IteratorStep, and IteratorValue order
    • arrays, code-point strings, Set, Map entries, generators, and observable custom iterators
    • stable yielded object/primitive EncodedJSValue identity with exact VM/global/context callback metadata
    • callback-published abrupt completion performs IteratorClose; a throwing return() cannot replace the first exception
    • same-VM sibling acceptance, foreign-VM rejection, and pre-existing pending-state preservation
    • focused unit matrix: 3/3 passed, 0 leaked
    • pinned consumer fixture: 229/229 symbols linked; runtime matrix passed
    • Home audit: 230/431 implemented, 201 pending, 0 unclassified
    • Bun core audit: 224/421 implemented, 197 pending, 0 unclassified
    • public classification: 117 public, 19 extensions, 234 private/support exports

    The committed 1,540-sample JSC benchmark artifact remains 36a617b3; this ABI-only slice did not regenerate performance scores.

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