Update cranelift to 0.26.0. (#64)

* Initial additional modules

* Update to cranelift 0.26.0

* Fixed formatting
This commit is contained in:
Lachlan Sneff
2018-12-17 21:30:27 -05:00
committed by GitHub
parent 6362bc349c
commit 93f8cdfc81
7 changed files with 238 additions and 58 deletions

View File

@ -383,8 +383,8 @@ impl Instance {
GlobalInit::I64Const(n) => n,
GlobalInit::F32Const(f) => f as _, // unsafe { mem::transmute(f as f64) },
GlobalInit::F64Const(f) => f as _, // unsafe { mem::transmute(f) },
GlobalInit::GlobalRef(global_index) => globals_data[global_index.index()],
GlobalInit::Import() => {
GlobalInit::GetGlobal(global_index) => globals_data[global_index.index()],
GlobalInit::Import => {
let (module_name, field_name) = import_name
.as_ref()
.expect("Expected a import name for the global import");
@ -438,7 +438,7 @@ impl Instance {
"The Imported table {}.{} is not provided, therefore will be mocked.",
module_name, field_name
);
let len = table.entity.size;
let len = table.entity.minimum as usize;
let mut v = Vec::with_capacity(len);
v.resize(len, 0);
v
@ -456,7 +456,7 @@ impl Instance {
}
}
None => {
let len = table.entity.size;
let len = table.entity.minimum as usize;
let mut v = Vec::with_capacity(len);
v.resize(len, 0);
v
@ -498,15 +498,15 @@ impl Instance {
// If we use emscripten, we set a fixed initial and maximum
debug!(
"Instance - init memory ({}, {:?})",
memory.pages_count, memory.maximum
memory.minimum, memory.maximum
);
let memory = if options.abi == InstanceABI::Emscripten {
// We use MAX_PAGES, so at the end the result is:
// (initial * LinearMemory::PAGE_SIZE) == LinearMemory::DEFAULT_HEAP_SIZE
// However, it should be: (initial * LinearMemory::PAGE_SIZE) == 16777216
LinearMemory::new(LinearMemory::MAX_PAGES as u32, None)
LinearMemory::new(LinearMemory::MAX_PAGES, None)
} else {
LinearMemory::new(memory.pages_count as u32, memory.maximum.map(|m| m as u32))
LinearMemory::new(memory.minimum, memory.maximum.map(|m| m as u32))
};
memories.push(memory);
}