Refine aot call_indirect opcode translation (#492)

Re-implement aot call_indirect opcode translation: when calling non-import function, translate it by LLVM call IR to call the function in AOTed code, so as to avoid calling runtime aot_call_indirect API which is much slower. For import function, keep calling aot_call_indirect API due to the possible pointer/string argument conversion.

And add prompt info while app heap is corrupted, change emit_leb to emit_uint32 inter fast-interp to refine footprint.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
Wenyong Huang
2021-01-05 04:05:30 -06:00
committed by GitHub
parent f2a63d8623
commit 788cbf2a19
15 changed files with 529 additions and 191 deletions

View File

@ -1688,7 +1688,17 @@ wasm_module_malloc(WASMModuleInstance *module_inst, uint32 size,
}
if (!addr) {
wasm_set_exception(module_inst, "out of memory");
if (memory->heap_handle
&& mem_allocator_is_heap_corrupted(memory->heap_handle)) {
LOG_ERROR("Error: app heap is corrupted, if the wasm file "
"is compiled by wasi-sdk-12.0 or larger version, "
"please add -Wl,--export=malloc -Wl,--export=free "
" to export malloc and free functions.");
wasm_set_exception(module_inst, "app heap corrupted");
}
else {
wasm_set_exception(module_inst, "out of memory");
}
return 0;
}
if (p_native_addr)