Skip to content

ABI: implement stable borrowed ZigString output views #200

Description

@chrisbbreuer

Parent

Scope

Implement the two pinned borrowed-output bridges:

  • JSC__JSString__toZigString for exact JSString cells.
  • JSC__JSValue__toZigString with full ordered ToString coercion and VM exception publication.

Return stable VM-lifetime views using untagged Latin-1 bytes for 8-bit strings and bit-63-tagged UTF-16 code units otherwise. The cache must be shared by sibling realms, isolated by VM, and released at context-group teardown.

Acceptance

  • Empty, ASCII, Latin-1, BMP, astral, and lone-surrogate strings expose exact length/tag/code units.
  • Repeated views remain stable across later allocations and sibling-realm calls.
  • JSValue conversion covers every primitive, object coercion order, thrown values, Symbols, foreign VMs, and first-exception preservation.
  • Invalid JSString cells zero the output without exposing unrelated memory.
  • Focused runtime, both inventories, README/docs, and parent trackers are current.

Completion evidence

Implemented on main in 6300bbc3; README and ABI documentation published in c13cc7f7.

  • Exact empty, ASCII, Latin-1, BMP, astral, and lone-surrogate lengths, tags, and code units are covered.
  • Borrowed buffers are VM-group-owned, stable across later allocations, shared by sibling realms, isolated across VMs, and released at group teardown.
  • JSValue output performs observable ToString for primitives and objects, preserving order and publishing Symbols, thrown values, and foreign inputs through the VM exception slot.
  • Invalid JSString cells and every failure path zero the output; a pre-existing exception remains first.
  • zig build test-home-private-abi -Doptimize=Debug passes 95/95 symbols.
  • Home audit: 97/431 implemented, 334 pending. Bun core audit: 90/421 implemented, 331 pending.

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