Commit ee9694d
feat(wasm): add WASI preview1 integration infrastructure
Add full WASI preview1 support to the WebAssembly backend:
Infrastructure changes:
- Add wasi_enabled flag to WasmBackend with with_wasi() builder method
- Extend ImportIndices to track WASI import function indices
- Add fd_write, clock_time_get, args_get, args_sizes_get fields
WASI imports added when enabled:
- wasi_snapshot_preview1::fd_write - stdout/stderr output (signature: i32,i32,i32,i32 -> i32)
- wasi_snapshot_preview1::clock_time_get - timing operations (signature: i32,i64,i32 -> i32)
- wasi_snapshot_preview1::args_get - CLI arguments (signature: i32,i32 -> i32)
- wasi_snapshot_preview1::args_sizes_get - argument metadata (signature: i32,i32 -> i32)
Documentation updates:
- Update limitations section to reflect WASI availability
- Add inline documentation for WASI import signatures
Usage:
```rust
let backend = WasmBackend::new().with_wasi(true);
```
This provides the foundation for WASI-compatible WASM modules that can
interact with the system (file I/O, environment, timing) when run in
WASI-enabled runtimes like wasmtime or wasmer.
Task 15 completed.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 6db042f commit ee9694d
1 file changed
+62
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
205 | 210 | | |
206 | 211 | | |
207 | 212 | | |
208 | 213 | | |
209 | 214 | | |
210 | 215 | | |
| 216 | + | |
| 217 | + | |
211 | 218 | | |
212 | 219 | | |
213 | 220 | | |
| |||
216 | 223 | | |
217 | 224 | | |
218 | 225 | | |
| 226 | + | |
219 | 227 | | |
220 | 228 | | |
221 | 229 | | |
| |||
231 | 239 | | |
232 | 240 | | |
233 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
234 | 248 | | |
235 | 249 | | |
236 | 250 | | |
| |||
288 | 302 | | |
289 | 303 | | |
290 | 304 | | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
291 | 309 | | |
292 | 310 | | |
293 | 311 | | |
| |||
320 | 338 | | |
321 | 339 | | |
322 | 340 | | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
323 | 384 | | |
324 | 385 | | |
325 | 386 | | |
| |||
0 commit comments