Skip to content

Commit 9169eff

Browse files
authored
Remove hardcoded stack size in thread_manager.c (#931)
Remove hardcoded stack size in thread_manager.c Signed-off-by: Huang Qi <[email protected]>
1 parent 78414b6 commit 9169eff

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

core/iwasm/libraries/thread-mgr/thread_manager.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55

66
#include "thread_manager.h"
77

8+
#if WASM_ENABLE_INTERP != 0
9+
#include "../interpreter/wasm_runtime.h"
10+
#endif
11+
#if WASM_ENABLE_AOT != 0
12+
#include "../aot/aot_runtime.h"
13+
#endif
14+
815
#if WASM_ENABLE_DEBUG_INTERP != 0
916
#include "debug_engine.h"
1017
#endif
@@ -341,13 +348,28 @@ wasm_cluster_spawn_exec_env(WASMExecEnv *exec_env)
341348
wasm_module_inst_t new_module_inst;
342349
WASMExecEnv *new_exec_env;
343350
uint32 aux_stack_start, aux_stack_size;
351+
uint32 stack_size = 8192;
344352

345353
if (!module) {
346354
return NULL;
347355
}
348356

357+
#if WASM_ENABLE_INTERP != 0
358+
if (module_inst->module_type == Wasm_Module_Bytecode) {
359+
stack_size =
360+
((WASMModuleInstance *)module_inst)->default_wasm_stack_size;
361+
}
362+
#endif
363+
364+
#if WASM_ENABLE_AOT != 0
365+
if (module_inst->module_type == Wasm_Module_AoT) {
366+
stack_size =
367+
((AOTModuleInstance *)module_inst)->default_wasm_stack_size;
368+
}
369+
#endif
370+
349371
if (!(new_module_inst = wasm_runtime_instantiate_internal(
350-
module, true, 8192, 0, NULL, 0))) {
372+
module, true, stack_size, 0, NULL, 0))) {
351373
return NULL;
352374
}
353375

0 commit comments

Comments
 (0)