Skip to content

Commit

Permalink
Remove feature validation from Wasmtime (#9623)
Browse files Browse the repository at this point in the history
Some of this originated in #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 #9622.

Closes #9622
  • Loading branch information
alexcrichton authored Nov 19, 2024
1 parent 925a4f4 commit dab9dc8
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 dab9dc8

Please sign in to comment.