Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

update future.{write,read} ABIs#199

Closed
dicej wants to merge 1 commit into
mainfrom
dicej/new-future-abi
Closed

update future.{write,read} ABIs#199
dicej wants to merge 1 commit into
mainfrom
dicej/new-future-abi

Conversation

@dicej
Copy link
Copy Markdown
Collaborator

@dicej dicej commented Jun 6, 2025

This updates the plumbing, FACT, compilation, and runtime code to use the new ABI defined in WebAssembly/component-model#524.

  • future.write now accepts its payload value as up to 4 flat parameters before spilling to linear memory.

  • future.read takes no payload pointer when it has no payload type

  • {stream,future}.close-{readable,writable} have been renamed to {stream,future}.drop-{readable,writable}

This commit does not address the following items:

  • There is no "number of elements written" packed in the high 28 bits of the future.{read,write} results.
  • On successful copy, future.{read,write} return COMPLETED instead of CLOSED (which, as noted above, was renamed to DROPPED, making it especially "wrong" as the result code).
  • When a future is "done" (by a COMPLETED read/write or by the writable end receiving DROPPED), the only valid operation is future.drop-{readable,writable}. future.{read,write} or lifting traps.
  • Because there's no great reason for streams to be more permissive than futures in this regard, streams are also given a "done" state with the same trapping rules as futures, but the stream "done" state is only set when DROPPED is received.

I'll address those in one or more follow-up commits.

This updates the plumbing, FACT, compilation, and runtime code to use the new
ABI defined in WebAssembly/component-model#524.

- `future.write` now accepts its payload value as up to 4 flat parameters before spilling to linear memory.

- `future.read` takes no payload pointer when it has no payload type

- `{stream,future}.close-{readable,writable}` have been renamed to `{stream,future}.drop-{readable,writable}`

This commit does _not_ address the following items:

> * There is no "number of elements written" packed in the high 28 bits of the `future.{read,write}` results.
> * On successful copy, `future.{read,write}` return `COMPLETED` instead of `CLOSED` (which, as noted above, was renamed to `DROPPED`, making it especially "wrong" as the result code).
> * When a `future` is "done" (by a `COMPLETED` read/write or by the writable end receiving `DROPPED`), the only valid operation is `future.drop-{readable,writable}`.  `future.{read,write}` or lifting traps.
> * Because there's no great reason for streams to be more permissive than futures in this regard, streams are also given a "done" state with the same trapping rules as futures, but the stream "done" state is only set when `DROPPED` is received.

I'll address those in one or more follow-up commits.

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
@dicej dicej marked this pull request as ready for review June 6, 2025 21:49
@dicej
Copy link
Copy Markdown
Collaborator Author

dicej commented Jun 6, 2025

Alex, Luke, and I just discussed this and decided we're going to scale back these changes given how big they turned out to be implementation-wise. I'm going to close this and open a new one next week.

@dicej dicej closed this Jun 6, 2025
@dicej dicej deleted the dicej/new-future-abi branch June 10, 2025 13:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant