Fix several typo/warning/unused-code issues (#2655)

- Fix typo in wamr-test-suites script
- Fix compilation warnings in libc-wasi posix.c
- Remove unused code fast-jit jit_frontend.c
- Remove duplicated exception print in `iwasm -f <function>`
- Fix return value in void function wasm_runtime_set_wasi_ctx
This commit is contained in:
Wenyong Huang 2023-10-24 09:19:45 +08:00 committed by GitHub
parent 9ed26404d5
commit 9d7931e1d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 84 deletions

View File

@ -312,7 +312,6 @@ execute_func(WASMModuleInstanceCommon *module_inst, const char *name,
#endif
int32 i, p, module_type;
uint64 total_size;
const char *exception;
char buf[128];
bh_assert(argc >= 0);
@ -632,9 +631,7 @@ fail:
if (argv1)
wasm_runtime_free(argv1);
exception = wasm_runtime_get_exception(module_inst);
bh_assert(exception);
os_printf("%s\n", exception);
bh_assert(wasm_runtime_get_exception(module_inst));
return false;
}

View File

@ -542,8 +542,7 @@ void
wasm_runtime_set_wasi_ctx(WASMModuleInstanceCommon *module_inst_comm,
WASIContext *wasi_ctx)
{
return wasm_native_set_context(module_inst_comm, g_wasi_context_key,
wasi_ctx);
wasm_native_set_context(module_inst_comm, g_wasi_context_key, wasi_ctx);
}
static void

View File

@ -2311,77 +2311,3 @@ jit_frontend_get_jitted_return_addr_offset()
{
return (uint32)offsetof(WASMInterpFrame, jitted_return_addr);
}
#if 0
#if WASM_ENABLE_THREAD_MGR != 0
bool
check_suspend_flags(JitCompContext *cc, JITFuncContext *func_ctx)
{
LLVMValueRef terminate_addr, terminate_flags, flag, offset, res;
JitBasicBlock *terminate_check_block, non_terminate_block;
JITFuncType *jit_func_type = func_ctx->jit_func->func_type;
JitBasicBlock *terminate_block;
/* Offset of suspend_flags */
offset = I32_FIVE;
if (!(terminate_addr = LLVMBuildInBoundsGEP(
cc->builder, func_ctx->exec_env, &offset, 1, "terminate_addr"))) {
jit_set_last_error("llvm build in bounds gep failed");
return false;
}
if (!(terminate_addr =
LLVMBuildBitCast(cc->builder, terminate_addr, INT32_PTR_TYPE,
"terminate_addr_ptr"))) {
jit_set_last_error("llvm build bit cast failed");
return false;
}
if (!(terminate_flags =
LLVMBuildLoad(cc->builder, terminate_addr, "terminate_flags"))) {
jit_set_last_error("llvm build bit cast failed");
return false;
}
/* Set terminate_flags memory accecc to volatile, so that the value
will always be loaded from memory rather than register */
LLVMSetVolatile(terminate_flags, true);
CREATE_BASIC_BLOCK(terminate_check_block, "terminate_check");
MOVE_BASIC_BLOCK_AFTER_CURR(terminate_check_block);
CREATE_BASIC_BLOCK(non_terminate_block, "non_terminate");
MOVE_BASIC_BLOCK_AFTER_CURR(non_terminate_block);
BUILD_ICMP(LLVMIntSGT, terminate_flags, I32_ZERO, res, "need_terminate");
BUILD_COND_BR(res, terminate_check_block, non_terminate_block);
/* Move builder to terminate check block */
SET_BUILDER_POS(terminate_check_block);
CREATE_BASIC_BLOCK(terminate_block, "terminate");
MOVE_BASIC_BLOCK_AFTER_CURR(terminate_block);
if (!(flag = LLVMBuildAnd(cc->builder, terminate_flags, I32_ONE,
"termination_flag"))) {
jit_set_last_error("llvm build AND failed");
return false;
}
BUILD_ICMP(LLVMIntSGT, flag, I32_ZERO, res, "need_terminate");
BUILD_COND_BR(res, terminate_block, non_terminate_block);
/* Move builder to terminate block */
SET_BUILDER_POS(terminate_block);
if (!jit_build_zero_function_ret(cc, func_ctx, jit_func_type)) {
goto fail;
}
/* Move builder to terminate block */
SET_BUILDER_POS(non_terminate_block);
return true;
fail:
return false;
}
#endif /* End of WASM_ENABLE_THREAD_MGR */
#endif

View File

@ -3169,8 +3169,8 @@ wasi_ssp_sock_open(wasm_exec_env_t exec_env, struct fd_table *curfds,
bool is_tcp = SOCKET_DGRAM == socktype ? false : true;
bool is_ipv4 = INET6 == af ? false : true;
int ret;
__wasi_filetype_t wasi_type;
__wasi_rights_t max_base, max_inheriting;
__wasi_filetype_t wasi_type = __WASI_FILETYPE_UNKNOWN;
__wasi_rights_t max_base = 0, max_inheriting = 0;
__wasi_errno_t error;
(void)poolfd;

View File

@ -386,7 +386,7 @@ function spec_test()
git apply ../../spec-test-script/simd_ignore_cases.patch
fi
if [[ ${ENABLE_MULTI_MODULE} == 1 && $1 == 'aot' ]]; then
git apply ../../spec-test-script/muti_module_aot_ignore_cases.patch
git apply ../../spec-test-script/multi_module_aot_ignore_cases.patch
fi
# udpate thread cases
@ -948,4 +948,4 @@ fi
echo -e "Test finish. Reports are under ${REPORT_DIR}"
DEBUG set +xv pipefail
echo "TEST SUCCESSFUL"
exit 0
exit 0