Skip to content
Prev Previous commit
Next Next commit
Review comments
  • Loading branch information
alexcrichton committed Feb 23, 2022
commit 946d18839c4accaf9dd00e8a02065fe298916e5e
2 changes: 1 addition & 1 deletion crates/fuzzing/src/generators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ impl Config {
config.simd_enabled = false;
config.memory64_enabled = false;

// If using the pooling allocator, update the module limits too
// If using the pooling allocator, update the instance limits too
if let InstanceAllocationStrategy::Pooling {
instance_limits: limits,
..
Expand Down
4 changes: 2 additions & 2 deletions crates/runtime/src/instance/allocator/pooling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ impl InstancePool {
if nmemories > self.memories.max_memories {
return Err(InstantiationError::Resource(anyhow!(
"instantiation requires {} memories to be created which \
exceeds the maximum of {} configured",
exceeds the configured maximum of {}",
nmemories,
self.memories.max_memories
)));
Expand Down Expand Up @@ -522,7 +522,7 @@ impl InstancePool {
if ntables > self.tables.max_tables {
return Err(InstantiationError::Resource(anyhow!(
"instantiation requires {} tables to be created which \
exceeds the maximum of {} configured",
exceeds the configured maximum of {}",
ntables,
self.tables.max_tables
)));
Expand Down
6 changes: 3 additions & 3 deletions crates/runtime/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,10 @@ impl Memory {

if base.len() < minimum {
bail!(
"memory allocation of {} bytes does not meet this module's \
minimum requirement of {} bytes",
base.len(),
"initial memory size of {} exceeds the pooling allocator's \
configured maximum memory size of {} bytes",
minimum,
base.len(),
);
}

Expand Down
6 changes: 3 additions & 3 deletions crates/runtime/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ impl Table {
let ty = wasm_to_table_type(plan.table.wasm_ty)?;
if data.len() < (plan.table.minimum as usize) {
bail!(
"table allocation of {} elements does not meet this module's \
minimum requirement of {} elements",
"initial table size of {} exceeds the pooling allocator's \
configured maximum table size of {} elements",
plan.table.minimum,
data.len(),
plan.table.minimum
);
}
let data = match plan.table.maximum {
Expand Down
12 changes: 6 additions & 6 deletions tests/all/pooling_allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn memory_limit() -> Result<()> {
Err(e) => assert_eq!(
e.to_string(),
"Insufficient resources: instantiation requires 2 memories to be \
created which exceeds the maximum of 1 configured",
created which exceeds the configured maximum of 1",
),
}
}
Expand All @@ -70,8 +70,8 @@ fn memory_limit() -> Result<()> {
Ok(_) => panic!("module instantiation should fail"),
Err(e) => assert_eq!(
e.to_string(),
"Insufficient resources: memory allocation of 196608 bytes \
does not meet this module's minimum requirement of 262144 bytes",
"Insufficient resources: initial memory size of 262144 exceeds the \
pooling allocator's configured maximum memory size of 196608 bytes",
),
}
}
Expand Down Expand Up @@ -276,7 +276,7 @@ fn table_limit() -> Result<()> {
Err(e) => assert_eq!(
e.to_string(),
"Insufficient resources: instantiation requires 2 tables to be \
created which exceeds the maximum of 1 configured",
created which exceeds the configured maximum of 1",
),
}
}
Expand All @@ -290,8 +290,8 @@ fn table_limit() -> Result<()> {
Ok(_) => panic!("module instantiation should fail"),
Err(e) => assert_eq!(
e.to_string(),
"Insufficient resources: table allocation of 10 elements does \
not meet this module's minimum requirement of 31 elements",
"Insufficient resources: initial table size of 31 exceeds the \
pooling allocator's configured maximum table size of 10 elements",
),
}
}
Expand Down