Add the pooling-allocator feature.
This commit adds the `pooling-allocator` feature to both the `wasmtime` and `wasmtime-runtime` crates. The feature controls whether or not the pooling allocator implementation is built into the runtime and exposed as a supported instance allocation strategy in the wasmtime API. The feature is on by default for the `wasmtime` crate. Closes #3513.
This commit is contained in:
@@ -49,8 +49,11 @@ default = []
|
||||
|
||||
async = ["wasmtime-fiber"]
|
||||
|
||||
# Enables support for the pooling instance allocator
|
||||
pooling-allocator = []
|
||||
|
||||
# Enables support for userfaultfd in the pooling allocator when building on Linux
|
||||
uffd = ["userfaultfd"]
|
||||
uffd = ["userfaultfd", "pooling-allocator"]
|
||||
|
||||
# Enables trap handling using POSIX signals instead of Mach exceptions on MacOS.
|
||||
# It is useful for applications that do not bind their own exception ports and
|
||||
|
||||
@@ -23,8 +23,10 @@ use wasmtime_environ::{
|
||||
SignatureIndex, TableInitializer, TrapCode, VMOffsets, WasmType, WASM_PAGE_SIZE,
|
||||
};
|
||||
|
||||
#[cfg(feature = "pooling-allocator")]
|
||||
mod pooling;
|
||||
|
||||
#[cfg(feature = "pooling-allocator")]
|
||||
pub use self::pooling::{
|
||||
InstanceLimits, ModuleLimits, PoolingAllocationStrategy, PoolingInstanceAllocator,
|
||||
};
|
||||
|
||||
@@ -40,9 +40,12 @@ pub use crate::export::*;
|
||||
pub use crate::externref::*;
|
||||
pub use crate::imports::Imports;
|
||||
pub use crate::instance::{
|
||||
InstanceAllocationRequest, InstanceAllocator, InstanceHandle, InstanceLimits,
|
||||
InstantiationError, LinkError, ModuleLimits, OnDemandInstanceAllocator,
|
||||
PoolingAllocationStrategy, PoolingInstanceAllocator, StorePtr,
|
||||
InstanceAllocationRequest, InstanceAllocator, InstanceHandle, InstantiationError, LinkError,
|
||||
OnDemandInstanceAllocator, StorePtr,
|
||||
};
|
||||
#[cfg(feature = "pooling-allocator")]
|
||||
pub use crate::instance::{
|
||||
InstanceLimits, ModuleLimits, PoolingAllocationStrategy, PoolingInstanceAllocator,
|
||||
};
|
||||
pub use crate::jit_int::GdbJitImageRegistration;
|
||||
pub use crate::memory::{Memory, RuntimeLinearMemory, RuntimeMemoryCreator};
|
||||
|
||||
@@ -364,6 +364,7 @@ impl Memory {
|
||||
}
|
||||
|
||||
/// Returns whether or not the underlying storage of the memory is "static".
|
||||
#[cfg(feature = "pooling-allocator")]
|
||||
pub(crate) fn is_static(&self) -> bool {
|
||||
if let Memory::Static { .. } = self {
|
||||
true
|
||||
|
||||
@@ -186,6 +186,7 @@ impl Table {
|
||||
}
|
||||
|
||||
/// Returns whether or not the underlying storage of the table is "static".
|
||||
#[cfg(feature = "pooling-allocator")]
|
||||
pub(crate) fn is_static(&self) -> bool {
|
||||
if let Table::Static { .. } = self {
|
||||
true
|
||||
|
||||
Reference in New Issue
Block a user