diff --git a/Cargo.lock b/Cargo.lock index db3415e182..bb9c59a7ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1186,6 +1186,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "flagset" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda653ca797810c02f7ca4b804b40b8b95ae046eb989d356bce17919a8c25499" + [[package]] name = "fnv" version = "1.0.7" @@ -3315,20 +3321,21 @@ checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" [[package]] name = "wasm-encoder" -version = "0.6.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2caacc74c68c74f0008c4055cdf509c43e623775eaf73323bb818dcf666ed9bd" +checksum = "aa9d9bf45fc46f71c407837c9b30b1e874197f2dc357588430b21e5017d290ab" dependencies = [ "leb128", ] [[package]] name = "wasm-smith" -version = "0.7.1" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab0a268c3562548522a7f98e057715fa37d1a39349354220886de6796b8a8ad4" +checksum = "1bf1f1ae7d995f2d82326fda2c92deb2444fd3e59bf885fe9a4bbe9bde3b6c93" dependencies = [ "arbitrary", + "flagset", "indexmap", "leb128", "wasm-encoder", diff --git a/crates/fuzzing/Cargo.toml b/crates/fuzzing/Cargo.toml index 05fe2d170c..8be5c4528b 100644 --- a/crates/fuzzing/Cargo.toml +++ b/crates/fuzzing/Cargo.toml @@ -19,8 +19,8 @@ wasmparser = "0.82" wasmprinter = "0.2.32" wasmtime = { path = "../wasmtime" } wasmtime-wast = { path = "../wast" } -wasm-encoder = "0.6.0" -wasm-smith = "0.7.0" +wasm-encoder = "0.10.0" +wasm-smith = "0.9.0" wasm-spec-interpreter = { path = "./wasm-spec-interpreter" } wasmi = "0.7.0" diff --git a/crates/fuzzing/src/generators.rs b/crates/fuzzing/src/generators.rs index ea6af185d2..4393522486 100644 --- a/crates/fuzzing/src/generators.rs +++ b/crates/fuzzing/src/generators.rs @@ -433,6 +433,7 @@ impl Config { cfg.wasm_bulk_memory(true) .wasm_reference_types(true) .wasm_module_linking(self.module_config.config.module_linking_enabled) + .wasm_multi_value(self.module_config.config.multi_value_enabled) .wasm_multi_memory(self.module_config.config.max_memories > 1) .wasm_simd(self.module_config.config.simd_enabled) .wasm_memory64(self.module_config.config.memory64_enabled) @@ -648,10 +649,9 @@ impl<'a> Arbitrary<'a> for ModuleConfig { // Allow multi-table by default. config.max_tables = config.max_tables.max(4); - // Allow enabling some various wasm proposals by default. - config.bulk_memory_enabled = u.arbitrary()?; - config.reference_types_enabled = u.arbitrary()?; - config.simd_enabled = u.arbitrary()?; + // Allow enabling some various wasm proposals by default. Note that + // these are all unconditionally turned off even with + // `SwarmConfig::arbitrary`. config.memory64_enabled = u.arbitrary()?; Ok(ModuleConfig { config }) diff --git a/crates/fuzzing/src/generators/table_ops.rs b/crates/fuzzing/src/generators/table_ops.rs index 04456b73de..c3e010a596 100644 --- a/crates/fuzzing/src/generators/table_ops.rs +++ b/crates/fuzzing/src/generators/table_ops.rs @@ -115,7 +115,7 @@ impl TableOps { val_type: wasm_encoder::ValType::ExternRef, mutable: true, }, - Instruction::RefNull(wasm_encoder::ValType::ExternRef), + &Instruction::RefNull(wasm_encoder::ValType::ExternRef), ); } @@ -130,7 +130,7 @@ impl TableOps { // implementations. let mut func = Function::new(vec![(1, ValType::ExternRef)]); - func.instruction(Instruction::Loop(wasm_encoder::BlockType::Empty)); + func.instruction(&Instruction::Loop(wasm_encoder::BlockType::Empty)); for op in self.ops.iter().take(MAX_OPS) { op.insert( &mut func, @@ -139,9 +139,9 @@ impl TableOps { self.num_globals() as u32, ); } - func.instruction(Instruction::Br(0)); - func.instruction(Instruction::End); - func.instruction(Instruction::End); + func.instruction(&Instruction::Br(0)); + func.instruction(&Instruction::End); + func.instruction(&Instruction::End); let mut code = CodeSection::new(); code.function(&func); @@ -222,101 +222,101 @@ impl TableOp { match self { Self::Gc => { - func.instruction(Instruction::Call(gc_func_idx)); - func.instruction(Instruction::Drop); - func.instruction(Instruction::Drop); - func.instruction(Instruction::Drop); + func.instruction(&Instruction::Call(gc_func_idx)); + func.instruction(&Instruction::Drop); + func.instruction(&Instruction::Drop); + func.instruction(&Instruction::Drop); } Self::Get(x) => { - func.instruction(Instruction::I32Const(x % table_mod)); - func.instruction(Instruction::TableGet { table: 0 }); - func.instruction(Instruction::Drop); + func.instruction(&Instruction::I32Const(x % table_mod)); + func.instruction(&Instruction::TableGet { table: 0 }); + func.instruction(&Instruction::Drop); } Self::SetFromParam(x, y) => { - func.instruction(Instruction::I32Const(x % table_mod)); - func.instruction(Instruction::LocalGet(y % num_params)); - func.instruction(Instruction::TableSet { table: 0 }); + func.instruction(&Instruction::I32Const(x % table_mod)); + func.instruction(&Instruction::LocalGet(y % num_params)); + func.instruction(&Instruction::TableSet { table: 0 }); } Self::SetFromGet(x, y) => { - func.instruction(Instruction::I32Const(x % table_mod)); - func.instruction(Instruction::I32Const(y % table_mod)); - func.instruction(Instruction::TableGet { table: 0 }); - func.instruction(Instruction::TableSet { table: 0 }); + func.instruction(&Instruction::I32Const(x % table_mod)); + func.instruction(&Instruction::I32Const(y % table_mod)); + func.instruction(&Instruction::TableGet { table: 0 }); + func.instruction(&Instruction::TableSet { table: 0 }); } Self::SetFromMake(x, y, z) => { - func.instruction(Instruction::Call(make_refs_func_idx)); + func.instruction(&Instruction::Call(make_refs_func_idx)); - func.instruction(Instruction::LocalSet(num_params)); - func.instruction(Instruction::I32Const(x % table_mod)); - func.instruction(Instruction::LocalGet(num_params)); - func.instruction(Instruction::TableSet { table: 0 }); + func.instruction(&Instruction::LocalSet(num_params)); + func.instruction(&Instruction::I32Const(x % table_mod)); + func.instruction(&Instruction::LocalGet(num_params)); + func.instruction(&Instruction::TableSet { table: 0 }); - func.instruction(Instruction::LocalSet(num_params)); - func.instruction(Instruction::I32Const(y % table_mod)); - func.instruction(Instruction::LocalGet(num_params)); - func.instruction(Instruction::TableSet { table: 0 }); + func.instruction(&Instruction::LocalSet(num_params)); + func.instruction(&Instruction::I32Const(y % table_mod)); + func.instruction(&Instruction::LocalGet(num_params)); + func.instruction(&Instruction::TableSet { table: 0 }); - func.instruction(Instruction::LocalSet(num_params)); - func.instruction(Instruction::I32Const(z % table_mod)); - func.instruction(Instruction::LocalGet(num_params)); - func.instruction(Instruction::TableSet { table: 0 }); + func.instruction(&Instruction::LocalSet(num_params)); + func.instruction(&Instruction::I32Const(z % table_mod)); + func.instruction(&Instruction::LocalGet(num_params)); + func.instruction(&Instruction::TableSet { table: 0 }); } TableOp::Make => { - func.instruction(Instruction::Call(make_refs_func_idx)); - func.instruction(Instruction::Drop); - func.instruction(Instruction::Drop); - func.instruction(Instruction::Drop); + func.instruction(&Instruction::Call(make_refs_func_idx)); + func.instruction(&Instruction::Drop); + func.instruction(&Instruction::Drop); + func.instruction(&Instruction::Drop); } TableOp::TakeFromParams(x, y, z) => { - func.instruction(Instruction::LocalGet(x % num_params)); - func.instruction(Instruction::LocalGet(y % num_params)); - func.instruction(Instruction::LocalGet(z % num_params)); - func.instruction(Instruction::Call(take_refs_func_idx)); + func.instruction(&Instruction::LocalGet(x % num_params)); + func.instruction(&Instruction::LocalGet(y % num_params)); + func.instruction(&Instruction::LocalGet(z % num_params)); + func.instruction(&Instruction::Call(take_refs_func_idx)); } TableOp::TakeFromGet(x, y, z) => { - func.instruction(Instruction::I32Const(x % table_mod)); - func.instruction(Instruction::TableGet { table: 0 }); + func.instruction(&Instruction::I32Const(x % table_mod)); + func.instruction(&Instruction::TableGet { table: 0 }); - func.instruction(Instruction::I32Const(y % table_mod)); - func.instruction(Instruction::TableGet { table: 0 }); + func.instruction(&Instruction::I32Const(y % table_mod)); + func.instruction(&Instruction::TableGet { table: 0 }); - func.instruction(Instruction::I32Const(z % table_mod)); - func.instruction(Instruction::TableGet { table: 0 }); + func.instruction(&Instruction::I32Const(z % table_mod)); + func.instruction(&Instruction::TableGet { table: 0 }); - func.instruction(Instruction::Call(take_refs_func_idx)); + func.instruction(&Instruction::Call(take_refs_func_idx)); } TableOp::TakeFromMake => { - func.instruction(Instruction::Call(make_refs_func_idx)); - func.instruction(Instruction::Call(take_refs_func_idx)); + func.instruction(&Instruction::Call(make_refs_func_idx)); + func.instruction(&Instruction::Call(take_refs_func_idx)); } Self::TakeFromGc => { - func.instruction(Instruction::Call(gc_func_idx)); - func.instruction(Instruction::Call(take_refs_func_idx)); + func.instruction(&Instruction::Call(gc_func_idx)); + func.instruction(&Instruction::Call(take_refs_func_idx)); } TableOp::GetGlobal(x) => { - func.instruction(Instruction::GlobalGet(x % num_globals)); - func.instruction(Instruction::Drop); + func.instruction(&Instruction::GlobalGet(x % num_globals)); + func.instruction(&Instruction::Drop); } TableOp::SetGlobalFromParam(global, param) => { - func.instruction(Instruction::LocalGet(param % num_params)); - func.instruction(Instruction::GlobalSet(global % num_globals)); + func.instruction(&Instruction::LocalGet(param % num_params)); + func.instruction(&Instruction::GlobalSet(global % num_globals)); } TableOp::SetGlobalFromGet(global, x) => { - func.instruction(Instruction::I32Const(x)); - func.instruction(Instruction::TableGet { table: 0 }); - func.instruction(Instruction::GlobalSet(global % num_globals)); + func.instruction(&Instruction::I32Const(x)); + func.instruction(&Instruction::TableGet { table: 0 }); + func.instruction(&Instruction::GlobalSet(global % num_globals)); } TableOp::SetGlobalFromMake(x, y, z) => { - func.instruction(Instruction::Call(make_refs_func_idx)); - func.instruction(Instruction::GlobalSet(x % num_globals)); - func.instruction(Instruction::GlobalSet(y % num_globals)); - func.instruction(Instruction::GlobalSet(z % num_globals)); + func.instruction(&Instruction::Call(make_refs_func_idx)); + func.instruction(&Instruction::GlobalSet(x % num_globals)); + func.instruction(&Instruction::GlobalSet(y % num_globals)); + func.instruction(&Instruction::GlobalSet(z % num_globals)); } TableOp::TakeFromGlobalGet(x, y, z) => { - func.instruction(Instruction::GlobalGet(x % num_globals)); - func.instruction(Instruction::GlobalGet(y % num_globals)); - func.instruction(Instruction::GlobalGet(z % num_globals)); - func.instruction(Instruction::Call(take_refs_func_idx)); + func.instruction(&Instruction::GlobalGet(x % num_globals)); + func.instruction(&Instruction::GlobalGet(y % num_globals)); + func.instruction(&Instruction::GlobalGet(z % num_globals)); + func.instruction(&Instruction::Call(take_refs_func_idx)); } } }