memory_grow_log

This commit is contained in:
vms 2021-05-18 21:02:42 +03:00
parent 5a83aef904
commit 676a31595a
2 changed files with 24 additions and 4 deletions

View File

@ -35,6 +35,7 @@ use wasmparser::Type as WpType;
static BACKEND_ID: &str = "cranelift";
#[allow(dead_code)]
pub struct CraneliftModuleCodeGenerator {
isa: Option<Box<dyn isa::TargetIsa>>,
signatures: Option<Arc<Map<SigIndex, FuncSig>>>,

View File

@ -37,6 +37,8 @@ pub unsafe extern "C" fn local_static_memory_grow(
Err(_) => -1,
};
println!("local static memory grow: delta {:?}, ret {}", delta, ret);
ctx.internal.memory_base = (*local_memory).base;
ctx.internal.memory_bound = (*local_memory).bound;
@ -56,7 +58,10 @@ pub unsafe extern "C" fn local_static_memory_size(
let local_memory = *ctx.internal.memories.add(memory_index.index());
let memory = (*local_memory).memory as *const StaticMemory;
(*memory).size()
let memory_size = (*memory).size();
// println!("local static memory size: ret {:?}", memory_size);
memory_size
}
/// Increase the size of the dynamic local memory with offset `memory_index` by
@ -82,6 +87,8 @@ pub unsafe extern "C" fn local_dynamic_memory_grow(
Err(_) => -1,
};
println!("local dynamic memory grow: delta {:?}, ret {}", delta, ret);
ctx.internal.memory_base = (*local_memory).base;
ctx.internal.memory_bound = (*local_memory).bound;
@ -101,7 +108,11 @@ pub unsafe extern "C" fn local_dynamic_memory_size(
let local_memory = *ctx.internal.memories.add(memory_index.index());
let memory = (*local_memory).memory as *const DynamicMemory;
(*memory).size()
let memory_size = (*memory).size();
// println!("local dynamic memory size: ret {:?}", memory_size);
memory_size
}
// +*****************************+
@ -156,7 +167,11 @@ pub unsafe extern "C" fn imported_static_memory_size(
.add(import_memory_index.index());
let memory = (*local_memory).memory as *const StaticMemory;
(*memory).size()
let memory_size = (*memory).size();
// println!("imported static memory size: ret {:?}", memory_size);
memory_size
}
/// Increase the size of the dynamic imported memory with offset `memory_index` by
@ -201,7 +216,11 @@ pub unsafe extern "C" fn imported_dynamic_memory_size(
let local_memory = *ctx.internal.imported_memories.add(memory_index.index());
let memory = (*local_memory).memory as *const DynamicMemory;
(*memory).size()
let memory_size = (*memory).size();
// println!("imported dynamic memory size: ret {:?}", memory_size);
memory_size
}
// +*****************************+