From 10e7fb7012fc297eaf27f5996692c3af97c6150f Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Wed, 7 May 2025 17:51:49 +0900 Subject: [PATCH] JIT: don't join worker threads twice in case of WASM_ENABLE_LAZY_JIT==0, compile_jit_functions should have already joined these threads. joining them again here is an undefined behavior. --- core/iwasm/interpreter/wasm_loader.c | 2 ++ core/iwasm/interpreter/wasm_mini_loader.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/core/iwasm/interpreter/wasm_loader.c b/core/iwasm/interpreter/wasm_loader.c index ef4020a36..8e21414ea 100644 --- a/core/iwasm/interpreter/wasm_loader.c +++ b/core/iwasm/interpreter/wasm_loader.c @@ -5711,6 +5711,7 @@ orcjit_thread_callback(void *arg) static void orcjit_stop_compile_threads(WASMModule *module) { +#if WASM_ENABLE_LAZY_JIT != 0 uint32 i, thread_num = (uint32)(sizeof(module->orcjit_thread_args) / sizeof(OrcJitThreadArg)); @@ -5719,6 +5720,7 @@ orcjit_stop_compile_threads(WASMModule *module) if (module->orcjit_threads[i]) os_thread_join(module->orcjit_threads[i], NULL); } +#endif } static bool diff --git a/core/iwasm/interpreter/wasm_mini_loader.c b/core/iwasm/interpreter/wasm_mini_loader.c index 23fb76370..4a4bed1cb 100644 --- a/core/iwasm/interpreter/wasm_mini_loader.c +++ b/core/iwasm/interpreter/wasm_mini_loader.c @@ -2493,6 +2493,7 @@ orcjit_thread_callback(void *arg) static void orcjit_stop_compile_threads(WASMModule *module) { +#if WASM_ENABLE_LAZY_JIT != 0 uint32 i, thread_num = (uint32)(sizeof(module->orcjit_thread_args) / sizeof(OrcJitThreadArg)); @@ -2501,6 +2502,7 @@ orcjit_stop_compile_threads(WASMModule *module) if (module->orcjit_threads[i]) os_thread_join(module->orcjit_threads[i], NULL); } +#endif } static bool