re-org platform APIs, simplify porting process (#201)

Co-authored-by: Xu Jun <jun1.xu@intel.com>
This commit is contained in:
Xu Jun
2020-03-16 16:43:57 +08:00
committed by GitHub
parent ef5ceffe71
commit f1a0e75ab7
177 changed files with 2954 additions and 7904 deletions

View File

@ -751,7 +751,7 @@ aot_enlarge_memory(AOTModuleInstance *module_inst, uint32 inc_page_count)
uint32 max_page_count = module_inst->mem_max_page_count;
uint32 total_page_count = cur_page_count + inc_page_count;
uint64 total_size = (uint64)num_bytes_per_page * total_page_count;
uint32 total_size_old;
uint32 total_size_old = module_inst->memory_data_size;
if (inc_page_count <= 0)
/* No need to enlarge memory */
@ -773,14 +773,14 @@ aot_enlarge_memory(AOTModuleInstance *module_inst, uint32 inc_page_count)
aot_set_exception(module_inst, "fail to enlarge memory.");
return false;
}
total_size_old = module_inst->memory_data_size;
bh_memcpy_s(mem_data_new, (uint32)total_size,
mem_data_old, total_size_old);
memset(mem_data_new + total_size_old,
0, (uint32)total_size - total_size_old);
wasm_runtime_free(mem_data_old);
}
memset(mem_data_new + total_size_old,
0, (uint32)total_size - total_size_old);
module_inst->mem_cur_page_count = total_page_count;
module_inst->memory_data_size = (uint32)total_size;
module_inst->memory_data.ptr = mem_data_new;