Avoid initialize LLVM repeatedly (#1671)

Currently we initialize and destroy LLVM environment in aot_create_comp_context
and aot_destroy_comp_context, which are called in wasm_module_load/unload,
and the latter may be invoked multiple times, which leads to duplicated LLVM
initialization/destroy and may result in unexpected behaviors.

Move the LLVM init/destroy into runtime init/destroy to resolve the issue.
This commit is contained in:
Wenyong Huang
2022-11-02 16:13:58 +08:00
committed by GitHub
parent f1f6f4a125
commit 5b144c491d
5 changed files with 68 additions and 11 deletions

View File

@ -63,6 +63,12 @@ typedef struct AOTCompOption {
uint32_t custom_sections_count;
} AOTCompOption, *aot_comp_option_t;
bool
aot_compiler_init(void);
void
aot_compiler_destroy(void);
aot_comp_context_t
aot_create_comp_context(aot_comp_data_t comp_data, aot_comp_option_t option);