@@ -2,12 +2,12 @@ use anyhow::{anyhow, bail, Result};
2
2
use criterion:: { criterion_group, criterion_main, BenchmarkId , Criterion } ;
3
3
use num_format:: { Locale , ToFormattedString } ;
4
4
use std:: { fmt:: Display , fs, path:: Path , process:: Command } ;
5
- use wasi_common:: {
6
- pipe:: { ReadPipe , WritePipe } ,
7
- sync:: WasiCtxBuilder ,
8
- WasiCtx ,
9
- } ;
10
5
use wasmtime:: { AsContextMut , Engine , Linker , Module , Store } ;
6
+ use wasmtime_wasi:: {
7
+ pipe:: { MemoryInputPipe , MemoryOutputPipe } ,
8
+ preview1:: WasiP1Ctx ,
9
+ WasiCtxBuilder ,
10
+ } ;
11
11
12
12
struct FunctionCase {
13
13
name : String ,
@@ -86,8 +86,8 @@ impl FunctionCase {
86
86
87
87
pub fn run (
88
88
& self ,
89
- linker : & mut Linker < WasiCtx > ,
90
- mut store : impl AsContextMut < Data = WasiCtx > ,
89
+ linker : & mut Linker < WasiP1Ctx > ,
90
+ mut store : impl AsContextMut < Data = WasiP1Ctx > ,
91
91
) -> Result < ( ) > {
92
92
let js_module = match & self . precompiled_elf_bytes {
93
93
Some ( bytes) => unsafe { Module :: deserialize ( & self . engine , bytes) } ?,
@@ -107,14 +107,14 @@ impl FunctionCase {
107
107
Ok ( ( ) )
108
108
}
109
109
110
- pub fn setup ( & self ) -> Result < ( Linker < WasiCtx > , Store < WasiCtx > ) > {
110
+ pub fn setup ( & self ) -> Result < ( Linker < WasiP1Ctx > , Store < WasiP1Ctx > ) > {
111
111
let mut linker = Linker :: new ( & self . engine ) ;
112
112
let wasi = WasiCtxBuilder :: new ( )
113
- . stdin ( Box :: new ( ReadPipe :: from ( & self . payload [ .. ] ) ) )
114
- . stdout ( Box :: new ( WritePipe :: new_in_memory ( ) ) )
115
- . stderr ( Box :: new ( WritePipe :: new_in_memory ( ) ) )
116
- . build ( ) ;
117
- wasi_common :: sync :: add_to_linker ( & mut linker, |s| s) . unwrap ( ) ;
113
+ . stdin ( MemoryInputPipe :: new ( self . payload . clone ( ) ) )
114
+ . stdout ( MemoryOutputPipe :: new ( usize :: MAX ) )
115
+ . stderr ( MemoryOutputPipe :: new ( usize :: MAX ) )
116
+ . build_p1 ( ) ;
117
+ wasmtime_wasi :: preview1 :: add_to_linker_sync ( & mut linker, |s| s) ? ;
118
118
let mut store = Store :: new ( & self . engine , wasi) ;
119
119
120
120
if let Linking :: Dynamic = self . linking {
0 commit comments