Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions core/iwasm/interpreter/wasm_interp_classic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1783,18 +1783,14 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
global = globals + global_idx;
global_addr = get_global_addr(global_data, global);
aux_stack_top = *(uint32 *)(frame_sp - 1);
if (wasm_exec_env_is_aux_stack_managed_by_runtime(exec_env)) {
if (aux_stack_top
<= exec_env->aux_stack_boundary.boundary) {
wasm_set_exception(module,
"wasm auxiliary stack overflow");
goto got_exception;
}
if (aux_stack_top > exec_env->aux_stack_bottom.bottom) {
wasm_set_exception(module,
"wasm auxiliary stack underflow");
goto got_exception;
}
if (aux_stack_top <= exec_env->aux_stack_boundary.boundary) {
wasm_set_exception(module, "wasm auxiliary stack overflow");
goto got_exception;
}
if (aux_stack_top > exec_env->aux_stack_bottom.bottom) {
wasm_set_exception(module,
"wasm auxiliary stack underflow");
goto got_exception;
}
*(int32 *)global_addr = aux_stack_top;
frame_sp--;
Expand Down
20 changes: 8 additions & 12 deletions core/iwasm/interpreter/wasm_interp_fast.c
Original file line number Diff line number Diff line change
Expand Up @@ -1576,18 +1576,14 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
global = globals + global_idx;
global_addr = get_global_addr(global_data, global);
aux_stack_top = frame_lp[GET_OFFSET()];
if (wasm_exec_env_is_aux_stack_managed_by_runtime(exec_env)) {
if (aux_stack_top
<= exec_env->aux_stack_boundary.boundary) {
wasm_set_exception(module,
"wasm auxiliary stack overflow");
goto got_exception;
}
if (aux_stack_top > exec_env->aux_stack_bottom.bottom) {
wasm_set_exception(module,
"wasm auxiliary stack underflow");
goto got_exception;
}
if (aux_stack_top <= exec_env->aux_stack_boundary.boundary) {
wasm_set_exception(module, "wasm auxiliary stack overflow");
goto got_exception;
}
if (aux_stack_top > exec_env->aux_stack_bottom.bottom) {
wasm_set_exception(module,
"wasm auxiliary stack underflow");
goto got_exception;
}
*(int32 *)global_addr = aux_stack_top;
#if WASM_ENABLE_MEMORY_PROFILING != 0
Expand Down
5 changes: 5 additions & 0 deletions core/iwasm/libraries/thread-mgr/thread_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,11 @@ wasm_cluster_create_thread(WASMExecEnv *exec_env,
goto fail2;
}
}
else {
/* Disable aux stack */
new_exec_env->aux_stack_boundary.boundary = 0;
new_exec_env->aux_stack_bottom.bottom = UINT32_MAX;
}

if (!wasm_cluster_add_exec_env(cluster, new_exec_env))
goto fail2;
Expand Down
9 changes: 8 additions & 1 deletion samples/wasi-threads/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ make \
THREAD_MODEL=posix
```

Build and run the samples
## Build and run the samples

```shell
$ mkdir build
Expand All @@ -22,3 +22,10 @@ $ ./iwasm wasm-apps/no_pthread.wasm
...
$ ./iwasm wasm-apps/exception_propagation.wasm
```

## Run samples in AOT mode
```shell
$ ../../../wamr-compiler/build/wamrc \
-o wasm-apps/no_pthread.aot wasm-apps/no_pthread.wasm
$ ./iwasm wasm-apps/no_pthread.aot
```