Use the more-asserts crate in more places.
This provides assert_le, assert_lt, and so on, which can print the values of the operands.
This commit is contained in:
@@ -185,7 +185,7 @@ impl CodeMemory {
|
||||
if previous.0.len() > 0 {
|
||||
self.mmaps.push(previous);
|
||||
} else {
|
||||
assert!(previous.1.len() == 0);
|
||||
assert_eq!(previous.1.len(), 0);
|
||||
}
|
||||
|
||||
self.position = 0;
|
||||
|
||||
@@ -101,8 +101,9 @@ impl FunctionTable {
|
||||
|
||||
unsafe {
|
||||
// Windows heap allocations are 32-bit aligned, but assert just in case
|
||||
assert!(
|
||||
(self.functions.as_mut_ptr() as u64) % 4 == 0,
|
||||
assert_eq!(
|
||||
(self.functions.as_mut_ptr() as u64) % 4,
|
||||
0,
|
||||
"function table allocation was not aligned"
|
||||
);
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ use cranelift_codegen::binemit::Reloc;
|
||||
use cranelift_codegen::ir::JumpTableOffsets;
|
||||
use cranelift_entity::PrimaryMap;
|
||||
use cranelift_wasm::{DefinedFuncIndex, Global, GlobalInit, Memory, Table, TableElementType};
|
||||
use more_asserts::assert_ge;
|
||||
use wasmtime_environ::{
|
||||
MemoryPlan, MemoryStyle, Module, Relocation, RelocationTarget, Relocations, TablePlan,
|
||||
};
|
||||
@@ -132,11 +133,11 @@ pub fn link_module(
|
||||
bound: import_bound,
|
||||
},
|
||||
) => {
|
||||
assert!(bound >= *import_bound);
|
||||
assert_ge!(bound, *import_bound);
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
assert!(memory.offset_guard_size >= import_memory.offset_guard_size);
|
||||
assert_ge!(memory.offset_guard_size, import_memory.offset_guard_size);
|
||||
|
||||
dependencies.insert(unsafe { InstanceHandle::from_vmctx(vmctx) });
|
||||
memory_imports.push(VMMemoryImport {
|
||||
|
||||
Reference in New Issue
Block a user