Refactor configuration for the pooling allocator (#5205)

This commit changes the APIs in the `wasmtime` crate for configuring the
pooling allocator. I plan on adding a few more configuration options in
the near future and the current structure was feeling unwieldy for
adding these new abstractions.

The previous `struct`-based API has been replaced with a builder-style
API in a similar shape as to `Config`. This is done to help make it
easier to add more configuration options in the future through adding
more methods as opposed to adding more field which could break prior
initializations.
This commit is contained in:
Alex Crichton
2022-11-04 15:06:45 -05:00
committed by GitHub
parent 7b7eeac1be
commit b14551d7ca
19 changed files with 531 additions and 567 deletions

View File

@@ -202,13 +202,11 @@ fn bench_instantiation(c: &mut Criterion) {
fn strategies() -> impl Iterator<Item = InstanceAllocationStrategy> {
[
InstanceAllocationStrategy::OnDemand,
InstanceAllocationStrategy::Pooling {
strategy: Default::default(),
instance_limits: InstanceLimits {
memory_pages: 10_000,
..Default::default()
},
},
InstanceAllocationStrategy::Pooling({
let mut config = PoolingAllocationConfig::default();
config.instance_memory_pages(10_000);
config
}),
]
.into_iter()
}