Tidy up some internals of instance allocation (#5346)
* Simplify the `ModuleRuntimeInfo` trait slightly Fold two functions into one as they're only called from one location anyway. * Remove ModuleRuntimeInfo::signature This is redundant as the array mapping is already stored within the `VMContext` so that can be consulted rather than having a separate trait function for it. This required altering the `Global` creation slightly to work correctly in this situation. * Remove a now-dead constant * Shared `VMOffsets` across instances This commit removes the computation of `VMOffsets` to being per-module instead of per-instance. The `VMOffsets` structure is also quite large so this shaves off 112 bytes per instance which isn't a huge impact but should help lower the cost of instantiating small modules. * Remove `InstanceAllocator::adjust_tunables` This is no longer needed or necessary with the pooling allocator. * Fix compile warning * Fix a vtune warning * Fix pooling tests * Fix another test warning
This commit is contained in:
@@ -23,10 +23,7 @@
|
||||
use anyhow::Error;
|
||||
use std::sync::atomic::{AtomicU64, AtomicUsize, Ordering};
|
||||
use std::sync::Arc;
|
||||
use wasmtime_environ::DefinedFuncIndex;
|
||||
use wasmtime_environ::DefinedMemoryIndex;
|
||||
use wasmtime_environ::FunctionLoc;
|
||||
use wasmtime_environ::SignatureIndex;
|
||||
use wasmtime_environ::{DefinedFuncIndex, DefinedMemoryIndex, HostPtr, VMOffsets};
|
||||
|
||||
#[macro_use]
|
||||
mod trampolines;
|
||||
@@ -172,15 +169,8 @@ pub trait ModuleRuntimeInfo: Send + Sync + 'static {
|
||||
/// The underlying Module.
|
||||
fn module(&self) -> &Arc<wasmtime_environ::Module>;
|
||||
|
||||
/// The signatures.
|
||||
fn signature(&self, index: SignatureIndex) -> VMSharedSignatureIndex;
|
||||
|
||||
/// The base address of where JIT functions are located.
|
||||
fn image_base(&self) -> usize;
|
||||
|
||||
/// Descriptors about each compiled function, such as the offset from
|
||||
/// `image_base`.
|
||||
fn function_loc(&self, func_index: DefinedFuncIndex) -> &FunctionLoc;
|
||||
/// Returns the address, in memory, that the function `index` resides at.
|
||||
fn function(&self, index: DefinedFuncIndex) -> *mut VMFunctionBody;
|
||||
|
||||
/// Returns the `MemoryImage` structure used for copy-on-write
|
||||
/// initialization of the memory, if it's applicable.
|
||||
@@ -198,6 +188,9 @@ pub trait ModuleRuntimeInfo: Send + Sync + 'static {
|
||||
/// Returns an array, indexed by `SignatureIndex` of all
|
||||
/// `VMSharedSignatureIndex` entries corresponding to the `SignatureIndex`.
|
||||
fn signature_ids(&self) -> &[VMSharedSignatureIndex];
|
||||
|
||||
/// Offset information for the current host.
|
||||
fn offsets(&self) -> &VMOffsets<HostPtr>;
|
||||
}
|
||||
|
||||
/// Returns the host OS page size, in bytes.
|
||||
|
||||
Reference in New Issue
Block a user