Skip to content

Stateful urwasm#1

Merged
dozreg-toplud merged 20 commits into
urbit:urwasmfrom
dozreg-toplud:urwasm_stateful
Aug 18, 2025
Merged

Stateful urwasm#1
dozreg-toplud merged 20 commits into
urbit:urwasmfrom
dozreg-toplud:urwasm_stateful

Conversation

@dozreg-toplud

Copy link
Copy Markdown
  • Adds two more sets of allocation functions to allocate code pages and linear memory buffer separately;
  • Adds a suspension stack: a callstack for operators/function calls in wasm3 and function calls in the hosting environment;
  • Adds resume routine to resolve suspended/blocked computation;
  • Adds pointer rewrite routine for m3 structs to allow persistent storage of the suspended module state

@dozreg-toplud dozreg-toplud marked this pull request as ready for review April 25, 2025 14:52
pkova added a commit to urbit/vere that referenced this pull request Jul 17, 2025
Depends on urbit/wasm3#1

Adds stateful jet for `++run:wasm-lia`:

- Defines two sets of allocators for m3 structs and codepages;
- Updates `_reduce_monad` to enable computation suspension;
- Adds `_get_state` to load wasm3 state from persistent cache table;
- Adds `_move_state` to store wasm3 state in persistent cache table with
the new key and remove an entry with the old key;
- updates `u3we_lia_run` version due to return type change in
urbit/urbit#7128;

Misc:
builtins for `c3_d`, motes

TODO:
- [x] optimizations:
    - [x] arena on a slab to prevent copying data one more time;
- [x] smarter m3 struct realloc (currently wastes memory since wasm3
uses realloc to grow dynamic arrays);
@dozreg-toplud dozreg-toplud merged commit 90c5126 into urbit:urwasm Aug 18, 2025
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