Skip to content

ABI: implement copied, atomic, and rope string construction #199

Description

@chrisbbreuer

Parent

Scope

Implement the exact shared private string-construction boundary against pinned Home and Bun revisions:

  • ZigString__toValueGC: copy every tagged Latin-1, UTF-8, and UTF-16 representation into a selected-VM JavaScript string.
  • ZigString__to16BitValue: match the pinned raw UTF-8-to-WTF string conversion contract.
  • ZigString__toAtomicValue: canonicalize equal strings to one VM-owned atomic string cell without leaking identity across VMs.
  • JSC__JSValue__createRopeString: perform ordered ToString conversion and concatenate exact UTF-16 code-unit sequences while publishing abrupt completion through the shared VM exception slot.

External-string callback/finalization exports and borrowed toZigString views are separate ownership families and are out of scope.

Acceptance

  • Every tagged input encoding covers empty, Latin-1, astral, and lone-surrogate cases.
  • Copying is proven by mutating source storage after construction.
  • Atomic strings converge within one VM and remain isolated across VMs.
  • Rope conversion covers primitive/object coercion order, same-VM siblings, foreign values, and first-exception preservation.
  • Focused runtime, both inventories, README/docs, and parent trackers are current.

Completion evidence

Implemented on main in 2bd1a7c6; README and ABI documentation published in 77bb23fa.

  • ZigString__toValueGC copies empty, Latin-1, UTF-8, UTF-16, astral, and lone-surrogate input; mutation-after-copy is covered.
  • ZigString__to16BitValue implements raw UTF-8 conversion and rejects invalid input through the VM exception slot.
  • ZigString__toAtomicValue uses one VM-owned intern table shared by sibling realms and isolated from foreign VMs.
  • JSC__JSValue__createRopeString performs left-then-right ToString, exact surrogate-pair concatenation, same-VM sibling acceptance, foreign-VM rejection, abrupt completion, and first-exception preservation.
  • zig build test-home-private-abi -Doptimize=Debug passes 93/93 symbols.
  • Home audit: 95/431 implemented, 336 pending. Bun core audit: 88/421 implemented, 333 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