diff --git a/core/iwasm/common/wasm_runtime_common.c b/core/iwasm/common/wasm_runtime_common.c index 7a5ded2cf..d50db068d 100644 --- a/core/iwasm/common/wasm_runtime_common.c +++ b/core/iwasm/common/wasm_runtime_common.c @@ -85,6 +85,28 @@ static korp_mutex loading_module_list_lock; static bh_list registered_module_list_head; static bh_list *const registered_module_list = ®istered_module_list_head; static korp_mutex registered_module_list_lock; + +void +wasm_runtime_propagate_exception_from_import( + WASMModuleInstanceCommon *parent, WASMModuleInstanceCommon *sub_module) +{ + static const char exception_prefix[] = "Exception: "; + const char *message = NULL; + + if (!parent || !sub_module) + return; + + message = wasm_get_exception(sub_module); + if (message && message[0] != '\0') { + if (!strncmp(message, exception_prefix, sizeof(exception_prefix) - 1)) { + message += sizeof(exception_prefix) - 1; + } + + wasm_set_exception(parent, message); + wasm_set_exception(sub_module, NULL); + } +} + static void wasm_runtime_destroy_registered_module_list(void); #endif /* WASM_ENABLE_MULTI_MODULE */ diff --git a/core/iwasm/common/wasm_runtime_common.h b/core/iwasm/common/wasm_runtime_common.h index 88f23485e..995f7236c 100644 --- a/core/iwasm/common/wasm_runtime_common.h +++ b/core/iwasm/common/wasm_runtime_common.h @@ -578,6 +578,10 @@ typedef struct WASMRegisteredModule { uint8 *orig_file_buf; uint32 orig_file_buf_size; } WASMRegisteredModule; + +void +wasm_runtime_propagate_exception_from_import( + WASMModuleInstanceCommon *parent, WASMModuleInstanceCommon *sub_module); #endif typedef package_type_t PackageType; diff --git a/core/iwasm/interpreter/wasm_runtime.c b/core/iwasm/interpreter/wasm_runtime.c index f07950630..7ac6a66fc 100644 --- a/core/iwasm/interpreter/wasm_runtime.c +++ b/core/iwasm/interpreter/wasm_runtime.c @@ -103,29 +103,6 @@ wasm_resolve_symbols(WASMModule *module) return ret; } -#if WASM_ENABLE_MULTI_MODULE != 0 -void -wasm_runtime_propagate_exception_from_import(WASMModuleInstance *parent, - WASMModuleInstance *sub_module) -{ - static const char exception_prefix[] = "Exception: "; - const char *message = NULL; - - if (!parent || !sub_module) - return; - - message = wasm_get_exception(sub_module); - if (message && message[0] != '\0') { - if (!strncmp(message, exception_prefix, sizeof(exception_prefix) - 1)) { - message += sizeof(exception_prefix) - 1; - } - - wasm_set_exception(parent, message); - wasm_set_exception(sub_module, NULL); - } -} -#endif - #if WASM_ENABLE_MULTI_MODULE != 0 static WASMFunction * wasm_resolve_function(const char *module_name, const char *function_name, diff --git a/core/iwasm/interpreter/wasm_runtime.h b/core/iwasm/interpreter/wasm_runtime.h index fef6eda43..0ba2049af 100644 --- a/core/iwasm/interpreter/wasm_runtime.h +++ b/core/iwasm/interpreter/wasm_runtime.h @@ -593,10 +593,6 @@ wasm_lookup_tag(const WASMModuleInstance *module_inst, const char *name, const char *signature); #endif -void -wasm_runtime_propagate_exception_from_import(WASMModuleInstance *parent, - WASMModuleInstance *sub_module); - #endif bool