Merge pull request #1966 from bytecodealliance/dev/wasi_threads

Merge wasi_threads to main
This commit is contained in:
Wenyong Huang
2023-02-17 17:42:47 +08:00
committed by GitHub
28 changed files with 985 additions and 43 deletions

View File

@ -2640,14 +2640,16 @@ wasm_set_aux_stack(WASMExecEnv *exec_env, uint32 start_offset, uint32 size)
WASMModuleInstance *module_inst =
(WASMModuleInstance *)exec_env->module_inst;
uint32 stack_top_idx = module_inst->module->aux_stack_top_global_index;
#if WASM_ENABLE_HEAP_AUX_STACK_ALLOCATION == 0
/* Check the aux stack space */
uint32 data_end = module_inst->module->aux_data_end;
uint32 stack_bottom = module_inst->module->aux_stack_bottom;
bool is_stack_before_data = stack_bottom < data_end ? true : false;
/* Check the aux stack space, currently we don't allocate space in heap */
if ((is_stack_before_data && (size > start_offset))
|| ((!is_stack_before_data) && (start_offset - data_end < size)))
return false;
#endif
if (stack_top_idx != (uint32)-1) {
/* The aux stack top is a wasm global,