Refine codes and fix several issues (#882)

Refine some codes in wasm loader
Add -Wshadow to gcc compile flags and fix some variable shadowed issues
Fix function parameter/return types not checked issue
Fix fast-interp loader reserve_block_ret() not handle V128 return type issue
Fix mini loader load_table_segment_section() failed issue
Add detailed comments for argc argument in wasm_runtime_call_wasm()
This commit is contained in:
Wenyong Huang
2021-12-10 18:13:17 +08:00
committed by GitHub
parent 915b26b0ec
commit 5547924e28
13 changed files with 273 additions and 289 deletions

View File

@ -311,35 +311,35 @@ check_type_compatible(uint8 src_type, uint8 dst_type)
if (!(func_type = \
LLVMFunctionType(ret_type, param_types, argc, false))) { \
aot_set_last_error("llvm add function type failed."); \
return false; \
goto fail; \
} \
if (comp_ctx->is_jit_mode) { \
/* JIT mode, call the function directly */ \
if (!(func_ptr_type = LLVMPointerType(func_type, 0))) { \
aot_set_last_error("llvm add pointer type failed."); \
return false; \
goto fail; \
} \
if (!(value = I64_CONST((uint64)(uintptr_t)name)) \
|| !(func = LLVMConstIntToPtr(value, func_ptr_type))) { \
aot_set_last_error("create LLVM value failed."); \
return false; \
goto fail; \
} \
} \
else if (comp_ctx->is_indirect_mode) { \
int32 func_index; \
if (!(func_ptr_type = LLVMPointerType(func_type, 0))) { \
aot_set_last_error("create LLVM function type failed."); \
return false; \
goto fail; \
} \
\
func_index = aot_get_native_symbol_index(comp_ctx, #name); \
if (func_index < 0) { \
return false; \
goto fail; \
} \
if (!(func = aot_get_func_from_table( \
comp_ctx, func_ctx->native_symbol, func_ptr_type, \
func_index))) { \
return false; \
goto fail; \
} \
} \
else { \
@ -349,7 +349,7 @@ check_type_compatible(uint8 src_type, uint8 dst_type)
&& !(func = LLVMAddFunction(comp_ctx->module, func_name, \
func_type))) { \
aot_set_last_error("llvm add function failed."); \
return false; \
goto fail; \
} \
} \
} while (0)

View File

@ -345,6 +345,8 @@ call_aot_free_frame_func(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
}
return true;
fail:
return false;
}
#endif /* end of (WASM_ENABLE_DUMP_CALL_STACK != 0) \
|| (WASM_ENABLE_PERF_PROFILING != 0) */