add invariant checks

This commit is contained in:
Yury Delendik
2019-09-12 16:16:32 -05:00
committed by Dan Gohman
parent 805fbb4d2a
commit 042c87763e
5 changed files with 27 additions and 11 deletions

View File

@@ -45,7 +45,7 @@ pub fn layout_vmcontext(
for (index, table) in module.table_plans.iter().skip(num_tables_imports) {
let def_index = module.defined_table_index(index).unwrap();
let offset = ofs.vmctx_vmtable_definition(def_index) as usize;
let current_elements = table.table.minimum as usize;
let current_elements = table.table.minimum;
unsafe {
assert_eq!(
::std::mem::size_of::<u32>() as u8,
@@ -56,7 +56,7 @@ pub fn layout_vmcontext(
.as_mut_ptr()
.add(offset)
.add(ofs.vmtable_definition_current_elements() as usize);
ptr::write(to as *mut u32, current_elements as u32);
ptr::write(to as *mut u32, current_elements);
}
table_relocs.push(TableRelocation {
index: def_index.index(),