Precompute fields in VMOffsets
This commit updates the implementation of `VMOffsets` to frontload all checked arithmetic on construction of the `VMOffsets` which allows eliding all checked arithmetic when accessing the fields of `VMOffsets`. For testing and such this adds a new constructor as well from a new `VMOffsetsFields` structure which is a clone of the old definition. This should help speed up some profile hot spots I've been seeing where with all the checked arithmetic on field sizes this was slowing down the various accessors during instantiation (which uses `VMOffsets` to initialize various fields of the `VMContext`).
This commit is contained in:
@@ -39,7 +39,7 @@ pub use crate::data_structures::*;
|
||||
pub use crate::module::*;
|
||||
pub use crate::module_environ::*;
|
||||
pub use crate::tunables::Tunables;
|
||||
pub use crate::vmoffsets::{TargetSharedSignatureIndex, VMOffsets, INTERRUPTED};
|
||||
pub use crate::vmoffsets::*;
|
||||
|
||||
/// WebAssembly page sizes are defined to be 64KiB.
|
||||
pub const WASM_PAGE_SIZE: u32 = 0x10000;
|
||||
|
||||
Reference in New Issue
Block a user