Merge pull request #1966 from bytecodealliance/dev/wasi_threads
Merge wasi_threads to main
This commit is contained in:
@ -4195,7 +4195,20 @@ check_wasi_abi_compatibility(const WASMModule *module,
|
||||
|
||||
memory = wasm_loader_find_export(module, "", "memory", EXPORT_KIND_MEMORY,
|
||||
error_buf, error_buf_size);
|
||||
if (!memory) {
|
||||
if (!memory
|
||||
#if WASM_ENABLE_LIB_WASI_THREADS != 0
|
||||
/*
|
||||
* with wasi-threads, it's still an open question if a memory
|
||||
* should be exported.
|
||||
*
|
||||
* https://github.com/WebAssembly/wasi-threads/issues/22
|
||||
* https://github.com/WebAssembly/WASI/issues/502
|
||||
*
|
||||
* Note: this code assumes the number of memories is at most 1.
|
||||
*/
|
||||
&& module->import_memory_count == 0
|
||||
#endif
|
||||
) {
|
||||
set_error_buf(error_buf, error_buf_size,
|
||||
"a module with WASI apis must export memory by default");
|
||||
return false;
|
||||
|
||||
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user