Skip to content

ABI: convert BunString values and arrays into native JS cells #196

Description

@chrisbbreuer

Parent

Scope

Build on #195's pinned BunString/WTFStringImpl layout to implement the non-URL conversion family:

  • BunString__toJS;
  • BunString__transferToJS;
  • BunString__toJSWithLength;
  • BunString__createArray.

URL-producing variants remain a separate DOMURL slice.

Acceptance

  • All four imports are implemented for both pinned profiles.
  • Transfer consumes exactly one owned reference and marks non-empty input Dead only after success.
  • Length truncation is by UTF-16 code unit, not UTF-8 byte.
  • Array conversion validates/converts atomically and preserves order.
  • Focused fixture, both audits, README, ABI docs, and parent issues are current.

Evidence

Implemented in 835ac339; documentation published in fd7298b7.

  • zig build test-home-private-abi -Doptimize=Debug: 84/84 combined symbols linked and runtime matrix passed.
  • zig build home-private-abi-audit bun-private-abi-audit: Home 86/431 implemented (345 pending); Bun 79/421 implemented (342 pending).
  • Coverage includes Empty/Dead, 8/16-bit WTFStringImpl, Latin-1/UTF-8/UTF-16 ZigString, astral and lone-surrogate text, UTF-16-unit prefixes that split a surrogate pair, non-mutating conversion, success-only transfer invalidation, owned ref release, zero-length/null and ordered array construction, selected-realm Array prototypes, failure atomicity, and first-exception preservation.

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