Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Use some more `TryVec` in a module (#14909)

Alex Crichtonc961398bf969
diff --git a/crates/environ/src/compile/module_artifacts.rs b/crates/environ/src/compile/module_artifacts.rs
index ff11c4b03a..b87b478bd8 100644
--- a/crates/environ/src/compile/module_artifacts.rs
+++ b/crates/environ/src/compile/module_artifacts.rs
@@ -186,12 +186,12 @@ impl<'a> ObjectBuilder<'a> {
Ok(CompiledModuleInfo {
module,
- func_names,
+ func_names: func_names.into(),
meta: Metadata {
has_unparsed_debuginfo,
code_section_offset: debuginfo.wasm_file.code_section_offset,
has_wasm_debuginfo: self.tunables.parse_wasm_debuginfo,
- dwarf,
+ dwarf: dwarf.into(),
},
checksum: WasmChecksum::from_binary(wasm, self.tunables.recording),
})
diff --git a/crates/environ/src/module_artifacts.rs b/crates/environ/src/module_artifacts.rs
index dc8bc0123a..f8091f9c84 100644
--- a/crates/environ/src/module_artifacts.rs
+++ b/crates/environ/src/module_artifacts.rs
@@ -595,7 +595,7 @@ pub struct CompiledModuleInfo {
pub meta: Metadata,
/// Sorted list, by function index, of names we have for this module.
- pub func_names: Vec<FunctionName>,
+ pub func_names: TryVec<FunctionName>,
/// Checksum of the source Wasm binary from which this module was compiled.
pub checksum: WasmChecksum,
@@ -633,7 +633,7 @@ pub struct Metadata {
/// Dwarf sections and the offsets at which they're stored in the
/// ELF_WASMTIME_DWARF
- pub dwarf: Vec<(u8, Range<u64>)>,
+ pub dwarf: TryVec<(u8, Range<u64>)>,
}
/// Value of a configured setting for a [`Compiler`](crate::Compiler)
diff --git a/crates/fuzzing/tests/oom/module.rs b/crates/fuzzing/tests/oom/module.rs
index 322ea17d4f..60a0afb0fd 100644
--- a/crates/fuzzing/tests/oom/module.rs
+++ b/crates/fuzzing/tests/oom/module.rs
@@ -1,6 +1,6 @@
#![cfg(arc_try_new)]
-use wasmtime::{Config, Engine, Module, Result};
+use wasmtime::{Config, Engine, Module, Result, WasmBacktraceDetails};
use wasmtime_fuzzing::oom::OomTest;
#[test]
@@ -8,6 +8,7 @@ fn module_deserialize() -> Result<()> {
let module_bytes = {
let mut config = Config::new();
config.concurrency_support(false);
+ config.wasm_backtrace_details(WasmBacktraceDetails::Enable);
let engine = Engine::new(&config)?;
let module = Module::new(
&engine,
@@ -23,9 +24,11 @@ fn module_deserialize() -> Result<()> {
(elem (i32.const 0) func 1)
(elem func 1)
- (func (export "func") (param i32) (result i32)
+ (func $f (export "func") (param i32) (result i32)
(call 0 (local.get 0))
)
+
+ (@custom ".debug_info" "a")
)
"#,
)?;
@@ -35,6 +38,7 @@ fn module_deserialize() -> Result<()> {
let mut config = Config::new();
config.enable_compiler(false);
config.concurrency_support(false);
+ config.wasm_backtrace_details(WasmBacktraceDetails::Enable);
let engine = Engine::new(&config)?;
OomTest::new()
diff --git a/crates/wasmtime/src/runtime/instantiate.rs b/crates/wasmtime/src/runtime/instantiate.rs
index 8640cdf43a..6d59781113 100644
--- a/crates/wasmtime/src/runtime/instantiate.rs
+++ b/crates/wasmtime/src/runtime/instantiate.rs
@@ -24,7 +24,7 @@ pub struct CompiledModule {
meta: Metadata,
index: Arc<CompiledFunctionsTable>,
/// Sorted list, by function index, of names we have for this module.
- func_names: Vec<FunctionName>,
+ func_names: TryVec<FunctionName>,
}
impl CompiledModule {