Move trap information to a section of the compiled image (#3241)
This commit moves the `traps` field of `FunctionInfo` into a section of the compiled artifact produced by Cranelift. This section is quite large and when previously encoded/decoded with `bincode` this can take quite some time to process. Traps are expected to be relatively rare and it's not necessarily the right tradeoff to spend so much time serializing/deserializing this data, so this commit offloads the section into a custom-encoded binary format located elsewhere in the compiled image. This is similar to #3240 in its goal which is to move very large pieces of metadata to their own sections to avoid decoding anything when we load a precompiled modules. This also has a small benefit that it's slightly more efficient storage for the trap information too, but that's a negligible benefit. This is part of #3230 to make loading modules fast.
This commit is contained in:
@@ -94,7 +94,9 @@ use cranelift_codegen::isa::{unwind::UnwindInfo, CallConv, TargetIsa};
|
||||
use cranelift_entity::PrimaryMap;
|
||||
use cranelift_wasm::{DefinedFuncIndex, FuncIndex, WasmFuncType, WasmType};
|
||||
use target_lexicon::CallingConvention;
|
||||
use wasmtime_environ::{FilePos, FunctionInfo, InstructionAddressMap, Module, TypeTables};
|
||||
use wasmtime_environ::{
|
||||
FilePos, FunctionInfo, InstructionAddressMap, Module, TrapInformation, TypeTables,
|
||||
};
|
||||
|
||||
pub use builder::builder;
|
||||
|
||||
@@ -122,6 +124,10 @@ pub struct CompiledFunction {
|
||||
/// location found in the wasm input.
|
||||
address_map: FunctionAddressMap,
|
||||
|
||||
/// Metadata about traps in this module, mapping code offsets to the trap
|
||||
/// that they may cause.
|
||||
traps: Vec<TrapInformation>,
|
||||
|
||||
relocations: Vec<Relocation>,
|
||||
value_labels_ranges: cranelift_codegen::ValueLabelsRanges,
|
||||
stack_slots: ir::StackSlots,
|
||||
|
||||
Reference in New Issue
Block a user