Skip to content

Commit

Permalink
Remove feature validation from Wasmtime
Browse files Browse the repository at this point in the history
Some of this originated in bytecodealliance#917 but nowadays it shouldn't be necessary
to control proposals like this. Instead it's probably best nowadays to
throw configuration at `wasmparser` and use its definition of features
to determine whether constructs make sense or not. This reduces the
amount of bits and pieces Wasmtime has to do and avoids interactions
such as bytecodealliance#9622.

Closes bytecodealliance#9622
  • Loading branch information
alexcrichton committed Nov 19, 2024
1 parent 62103df commit 6cc58dd
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions crates/wasmtime/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2016,25 +2016,6 @@ impl Config {
panic!("should have returned an error by now")
}

if features.contains(WasmFeatures::REFERENCE_TYPES)
&& !features.contains(WasmFeatures::BULK_MEMORY)
{
bail!("feature 'reference_types' requires 'bulk_memory' to be enabled");
}
if features.contains(WasmFeatures::THREADS) && !features.contains(WasmFeatures::BULK_MEMORY)
{
bail!("feature 'threads' requires 'bulk_memory' to be enabled");
}
if features.contains(WasmFeatures::FUNCTION_REFERENCES)
&& !features.contains(WasmFeatures::REFERENCE_TYPES)
{
bail!("feature 'function_references' requires 'reference_types' to be enabled");
}
if features.contains(WasmFeatures::GC)
&& !features.contains(WasmFeatures::FUNCTION_REFERENCES)
{
bail!("feature 'gc' requires 'function_references' to be enabled");
}
#[cfg(feature = "async")]
if self.async_support && self.max_wasm_stack > self.async_stack_size {
bail!("max_wasm_stack size cannot exceed the async_stack_size");
Expand Down

0 comments on commit 6cc58dd

Please sign in to comment.