Add Pages and Bytes newtypes

This commit is contained in:
Lachlan Sneff
2019-01-29 15:44:15 -08:00
parent bc78738bb7
commit 69e9c5154d
16 changed files with 278 additions and 138 deletions

View File

@ -13,8 +13,6 @@ use wasmer_runtime_core::{
vm,
};
const WASM_PAGE_SIZE: usize = 65_536;
pub struct FuncEnv<'env, 'module, 'isa> {
env: &'env ModuleEnv<'module, 'isa>,
}
@ -219,7 +217,7 @@ impl<'env, 'module, 'isa> FuncEnvironment for FuncEnv<'env, 'module, 'isa> {
func.create_heap(ir::HeapData {
base: local_memory_base,
min_size: ((description.minimum as u64) * (WASM_PAGE_SIZE as u64)).into(),
min_size: (description.minimum.bytes().0 as u64).into(),
offset_guard_size: mem_type.guard_size().into(),
style: ir::HeapStyle::Dynamic {
bound_gv: local_memory_bound,
@ -230,7 +228,7 @@ impl<'env, 'module, 'isa> FuncEnvironment for FuncEnv<'env, 'module, 'isa> {
mem_type @ MemoryType::Static | mem_type @ MemoryType::SharedStatic => func
.create_heap(ir::HeapData {
base: local_memory_base,
min_size: ((description.minimum as u64) * (WASM_PAGE_SIZE as u64)).into(),
min_size: (description.minimum.bytes().0 as u64).into(),
offset_guard_size: mem_type.guard_size().into(),
style: ir::HeapStyle::Static {
bound: mem_type.bounds().unwrap().into(),