Fix several issues found (#1996)

- CMakeLists.txt: add lib_export.h to install list
- Fast JIT: enlarge spill cache size to enable several standalone cases
                when hw bound check is disabled
- Thread manager: wasm_cluster_exit_thread may destroy an invalid
               exec_env->module_inst when exec_env was destroyed before
- samples/socket-api: fix failure to run timeout_client.wasm
- enhance CI build wasi-libc and sample/wasm-c-api-imports CMakeLlist.txt
This commit is contained in:
Wenyong Huang 2023-03-03 15:00:54 +08:00 committed by GitHub
parent 9f0c4b63ac
commit 1be202fad8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 8 deletions

View File

@ -367,7 +367,7 @@ jobs:
git fetch https://github.com/WebAssembly/wasi-libc \
8f5275796a82f8ecfd0833a4f3f444fa37ed4546
git checkout FETCH_HEAD
make \
make -j \
AR=/opt/wasi-sdk/bin/llvm-ar \
NM=/opt/wasi-sdk/bin/llvm-nm \
CC=/opt/wasi-sdk/bin/clang \

View File

@ -160,4 +160,5 @@ install (TARGETS iwasm_shared LIBRARY DESTINATION lib)
install (FILES
${WAMR_ROOT_DIR}/core/iwasm/include/wasm_c_api.h
${WAMR_ROOT_DIR}/core/iwasm/include/wasm_export.h
${WAMR_ROOT_DIR}/core/iwasm/include/lib_export.h
DESTINATION include)

View File

@ -841,7 +841,7 @@ init_func_translation(JitCompContext *cc)
cc->spill_cache_offset = wasm_interp_interp_frame_size(total_cell_num);
/* Set spill cache size according to max local cell num, max stack cell
num and virtual fixed register num */
cc->spill_cache_size = (max_locals + max_stacks) * 4 + sizeof(void *) * 5;
cc->spill_cache_size = (max_locals + max_stacks) * 4 + sizeof(void *) * 16;
cc->total_frame_size = cc->spill_cache_offset + cc->spill_cache_size;
cc->jitted_return_address_offset =
offsetof(WASMInterpFrame, jitted_return_addr);

View File

@ -896,6 +896,7 @@ void
wasm_cluster_exit_thread(WASMExecEnv *exec_env, void *retval)
{
WASMCluster *cluster;
WASMModuleInstanceCommon *module_inst;
#ifdef OS_ENABLE_HW_BOUND_CHECK
if (exec_env->jmpbuf_stack_top) {
@ -926,6 +927,8 @@ wasm_cluster_exit_thread(WASMExecEnv *exec_env, void *retval)
os_mutex_lock(&cluster->lock);
module_inst = exec_env->module_inst;
/* Free aux stack space */
free_aux_stack(exec_env, exec_env->aux_stack_bottom.bottom);
/* Remove exec_env */
@ -933,7 +936,7 @@ wasm_cluster_exit_thread(WASMExecEnv *exec_env, void *retval)
/* Destroy exec_env */
wasm_exec_env_destroy_internal(exec_env);
/* Routine exit, destroy instance */
wasm_runtime_deinstantiate_internal(exec_env->module_inst, true);
wasm_runtime_deinstantiate_internal(module_inst, true);
os_mutex_unlock(&cluster->lock);

View File

@ -121,7 +121,7 @@ Shuting down
```
```bash
$ ./iwasm --addr-pool=127.0.0.1/15 --heap-size=10000000 timeout_client.wasm
$ ./iwasm --addr-pool=127.0.0.1/15 timeout_client.wasm
```
The output is:

View File

@ -54,7 +54,9 @@ function(COMPILE_WITH_CLANG SOURCE_FILE)
target_link_options(${MAIN_TARGET_NAME} PRIVATE
LINKER:--export=__heap_base
LINKER:--export=__data_end
LINKER:--shared-memory,--max-memory=196608
LINKER:--export=malloc
LINKER:--export=free
LINKER:--shared-memory,--max-memory=10485760
LINKER:--no-check-features
LINKER:--allow-undefined
)

View File

@ -56,10 +56,15 @@ if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release)
endif ()
set(WAMR_BUILD_AOT 1)
set(WAMR_BUILD_INTERP 0)
if (NOT DEFINED WAMR_BUILD_AOT)
# Enable AOT by default.
set (WAMR_BUILD_AOT 1)
endif ()
if (NOT DEFINED WAMR_BUILD_INTERP)
# Disable Interpreter by default
set (WAMR_BUILD_INTERP 0)
endif ()
set(WAMR_BUILD_JIT 0)
set(WAMR_BUILD_FAST_INTERP 1)
set(WAMR_BUILD_LIB_PTHREAD 1)
set(WAMR_BUILD_LIBC_BUILTIN 1)