Fix wamr compiler issues and refine some error messages (#470)

Fix potential memory leak issue when using llvm::EngineBuilder().selectTarget()
Fix issue of accessing aot_value's fields after it is freed
Fix JIT not print failed to link import warning
Change some error messages: 'fail to' to 'failed to'
Update error message when SIMD isn't enabled
Fix install littlevgl wasm app of wasi version failed

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
Wenyong Huang
2020-12-14 23:05:39 -06:00
committed by GitHub
parent 619c2b383c
commit 16e6f41b3a
11 changed files with 54 additions and 44 deletions

View File

@ -941,7 +941,7 @@ wasm_interp_call_func_native(WASMModuleInstance *module_inst,
if (!func_import->func_ptr_linked) {
snprintf(buf, sizeof(buf),
"fail to call unlinked import function (%s, %s)",
"failed to call unlinked import function (%s, %s)",
func_import->module_name, func_import->field_name);
wasm_set_exception(module_inst, buf);
return;
@ -998,7 +998,7 @@ wasm_interp_call_func_import(WASMModuleInstance *module_inst,
if (!sub_func_inst) {
snprintf(buf, sizeof(buf),
"fail to call unlinked import function (%s, %s)",
"failed to call unlinked import function (%s, %s)",
func_import->module_name, func_import->field_name);
wasm_set_exception(module_inst, buf);
return;
@ -1865,7 +1865,7 @@ label_pop_csp_n:
delta = (uint32)POP_I32();
if (!wasm_enlarge_memory(module, delta)) {
/* fail to memory.grow, return -1 */
/* failed to memory.grow, return -1 */
PUSH_I32(-1);
}
else {

View File

@ -987,8 +987,8 @@ wasm_interp_call_func_native(WASMModuleInstance *module_inst,
if (!func_import->func_ptr_linked) {
char buf[128];
snprintf(buf,
sizeof(buf), "fail to call unlinked import function (%s, %s)",
snprintf(buf, sizeof(buf),
"failed to call unlinked import function (%s, %s)",
func_import->module_name, func_import->field_name);
wasm_set_exception((WASMModuleInstance*)module_inst, buf);
return;
@ -1043,7 +1043,7 @@ wasm_interp_call_func_import(WASMModuleInstance *module_inst,
if (!sub_func_inst) {
snprintf(buf, sizeof(buf),
"fail to call unlinked import function (%s, %s)",
"failed to call unlinked import function (%s, %s)",
func_import->module_name, func_import->field_name);
wasm_set_exception(module_inst, buf);
return;
@ -1796,7 +1796,7 @@ recover_br_info:
delta = (uint32)frame_lp[addr1];
if (!wasm_enlarge_memory(module, delta)) {
/* fail to memory.grow, return -1 */
/* failed to memory.grow, return -1 */
frame_lp[addr_ret] = -1;
}
else {

View File

@ -1841,8 +1841,12 @@ load_function_section(const uint8 *buf, const uint8 *buf_end,
#endif
#endif
) {
set_error_buf(error_buf, error_buf_size,
"invalid local type");
if (type == VALUE_TYPE_V128)
set_error_buf(error_buf, error_buf_size,
"v128 value type requires simd feature");
else
set_error_buf_v(error_buf, error_buf_size,
"invalid local type 0x%02X", type);
return false;
}
for (k = 0; k < sub_local_count; k++) {

View File

@ -388,19 +388,6 @@ load_function_import(const WASMModule *parent_module, WASMModule *sub_module,
&linked_call_conv_raw);
}
if (!linked_func) {
#if WASM_ENABLE_SPEC_TEST != 0
set_error_buf(error_buf, error_buf_size,
"unknown import or incompatible import type");
return false;
#else
#if WASM_ENABLE_WAMR_COMPILER == 0
LOG_WARNING("warning: fail to link import function (%s, %s)",
sub_module_name, function_name);
#endif
#endif
}
function->module_name = sub_module_name;
function->field_name = function_name;
function->func_type = declare_func_type;

View File

@ -1097,7 +1097,7 @@ check_linked_symbol(WASMModuleInstance *module_inst, char *error_buf,
return false;
#else
#if WASM_ENABLE_WAMR_COMPILER == 0
LOG_WARNING("warning: fail to link import function (%s, %s)",
LOG_WARNING("warning: failed to link import function (%s, %s)",
func->module_name, func->field_name);
#else
/* do nothing to avoid confused message */
@ -1115,7 +1115,7 @@ check_linked_symbol(WASMModuleInstance *module_inst, char *error_buf,
return false;
#else
#if WASM_ENABLE_WAMR_COMPILER == 0
LOG_DEBUG("warning: fail to link import global (%s, %s)",
LOG_DEBUG("warning: failed to link import global (%s, %s)",
global->module_name, global->field_name);
#else
/* do nothing to avoid confused message */