Skip to content

docs(roadmap): guests reach host objects by handle, and copy only what they read - #1092

Merged
transfix merged 1 commit into
masterfrom
docs/guest-data-handles
Nov 9, 2026
Merged

transfix merged 1 commit into
masterfrom
docs/guest-data-handles

Conversation

@transfix

@transfix transfix commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Docs only. This adds docs/roadmap/ARIADNE_SCRIPTING_HOSTS.md §8.4.1, "Host objects: handles, and copies of only what is read". It replaces §8.4's "a volume or a mesh is copied between memories" with a handle design for the guest ABI. It is a proposal for review; nothing is built.

The design follows what the DSL already does. On a node holding a host object, (state-data-get path) returns an opaque data_object (a shared pointer to the payload) and copies nothing.

  • Handles.
    • A data_object crossing to a guest becomes a tagged CBOR integer: a handle into the instance's table.
    • The table holds the object by shared pointer, so the guest pins the version it was handed. Volumes are copy-on-write, so that copies nothing.
    • Each handle carries a generation, so a guest can't forge or reuse one.
    • handle_drop releases one, and the table goes with the instance.
  • Metadata: data_info(h) returns the type, dimensions, voxel type, bounds and counts.
  • Reads: volume_read, volume_sample, mesh_read and heightfield_read copy only the requested region, as raw typed arrays straight into a buffer the guest allocated.
  • Writes: volume_write, and volume_new plus state_data_set to publish a new object.
  • Host operations: host functions take and return handles through call, so a control-logic guest never copies the data at all.
  • Cost and access:
    • Reads and writes are charged by the byte at data_job's rate, so they count against the gas cap and the frame budget.
    • Handles come only through the lane's chroot.
    • imports: gains data.read / data.write (§8.6).
  • The floor. Core wasm can't read host memory in place, so a guest that reads data copies the region it reads. In the other direction, the host reads a guest buffer in place for the duration of one call.
  • Phases: the handle table, data_info and the readers come with G1's ABI; the writers and more object kinds follow as guests need them.
  • Risk 11 narrows to measuring the cost of a read: a volume-sized brick sweep, from wasmtime and from the browser, against the same sweep in the DSL and in pycvc.

#1091 edits other parts of the same file (the status lines, §3.1, §8.3 and the P1b/L1/G1 rows). The hunks don't overlap.

…t they read

ARIADNE_SCRIPTING_HOSTS.md 8.4.1: a volume, a mesh, a heightfield or a city
bundle crosses to a guest as a handle into the instance's table, as
(state-data-get) already returns a data_object in the DSL. data_info reads
the metadata; volume_read / volume_sample / mesh_read / heightfield_read copy
only the region asked for, straight into the guest's memory; host functions
take and return handles, so a control-logic guest need never copy at all.
Reads are charged by the byte at data_job's rate, and imports: gains
data.read / data.write (8.6). Risk 11 narrows to measuring a read.
@transfix
transfix enabled auto-merge (squash) November 9, 2026 07:23
@transfix
transfix merged commit 8dd444a into master Nov 9, 2026
10 of 93 checks passed
@transfix
transfix deleted the docs/guest-data-handles branch November 9, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant