https://github.com/nikvolf/wasmtime-fork
https://github.com/nikvolf/wasmtime-fork
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/nikvolf/wasmtime-fork
- Owner: NikVolf
- Created: 2020-03-17T08:06:29.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-15T09:58:23.000Z (almost 6 years ago)
- Last Synced: 2025-02-24T13:22:27.268Z (over 1 year ago)
- Language: Rust
- Size: 33.2 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# wasmtime-fork
Proof-of-concept wasmtime host that can fork execution of WASM v1.
This is based on Parity fork of wasmtime.
## How it works.
1. Host provides an import
```
fork(i32, i64) -> i32
```
Those are 3 arguments encoded (2 of them compactified to last argument):
- entry point of the new spawned process (function item).
- payload pointer passed to the entry point.
- payload length passed to the entry point.
2. Embedded program calls to the `fork(&some_func, &payload)`.
3. Host spawns new thread and creates new instance in that thread based on the same compiled module.
4. Host allocates memory inside child instance and writes payload to it (embedded progam should expose `allocate` function)
5. Host starts `invoke` function inside child instance and passes entry_point that parent process originally used.
6. Parent and child now run in parallel!