mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-03-12 08:55:28 +00:00
Remove unused LLVM JIT wapper functions (#1747)
Only create the necessary wrapper functions for LLVM JIT
This commit is contained in:
parent
0456043d8d
commit
96570cca22
|
@ -54,6 +54,7 @@ aot_add_llvm_func(AOTCompContext *comp_ctx, LLVMModuleRef module,
|
||||||
char func_name[48];
|
char func_name[48];
|
||||||
uint64 size;
|
uint64 size;
|
||||||
uint32 i, j = 0, param_count = (uint64)aot_func_type->param_count;
|
uint32 i, j = 0, param_count = (uint64)aot_func_type->param_count;
|
||||||
|
uint32 backend_thread_num, compile_thread_num;
|
||||||
|
|
||||||
/* exec env as first parameter */
|
/* exec env as first parameter */
|
||||||
param_count++;
|
param_count++;
|
||||||
|
@ -119,7 +120,16 @@ aot_add_llvm_func(AOTCompContext *comp_ctx, LLVMModuleRef module,
|
||||||
if (p_func_type)
|
if (p_func_type)
|
||||||
*p_func_type = func_type;
|
*p_func_type = func_type;
|
||||||
|
|
||||||
if (comp_ctx->is_jit_mode) {
|
backend_thread_num = WASM_ORC_JIT_BACKEND_THREAD_NUM;
|
||||||
|
compile_thread_num = WASM_ORC_JIT_COMPILE_THREAD_NUM;
|
||||||
|
|
||||||
|
/* Add the jit wrapper function with simple prototype, so that we
|
||||||
|
can easily call it to trigger its compilation and let LLVM JIT
|
||||||
|
compile the actual jit functions by adding them into the function
|
||||||
|
list in the PartitionFunction callback */
|
||||||
|
if (comp_ctx->is_jit_mode
|
||||||
|
&& (func_index % (backend_thread_num * compile_thread_num)
|
||||||
|
< backend_thread_num)) {
|
||||||
func_type_wrapper = LLVMFunctionType(VOID_TYPE, NULL, 0, false);
|
func_type_wrapper = LLVMFunctionType(VOID_TYPE, NULL, 0, false);
|
||||||
if (!func_type_wrapper) {
|
if (!func_type_wrapper) {
|
||||||
aot_set_last_error("create LLVM function type failed.");
|
aot_set_last_error("create LLVM function type failed.");
|
||||||
|
|
|
@ -2955,7 +2955,7 @@ orcjit_thread_callback(void *arg)
|
||||||
LLVMOrcLLLazyJITLookup(comp_ctx->orc_jit, &func_addr, func_name);
|
LLVMOrcLLLazyJITLookup(comp_ctx->orc_jit, &func_addr, func_name);
|
||||||
if (error != LLVMErrorSuccess) {
|
if (error != LLVMErrorSuccess) {
|
||||||
char *err_msg = LLVMGetErrorMessage(error);
|
char *err_msg = LLVMGetErrorMessage(error);
|
||||||
os_printf("failed to compile orc jit function: %s", err_msg);
|
os_printf("failed to compile orc jit function: %s\n", err_msg);
|
||||||
LLVMDisposeErrorMessage(err_msg);
|
LLVMDisposeErrorMessage(err_msg);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1930,8 +1930,8 @@ compile_llvm_jit_functions(WASMModule *module, char *error_buf,
|
||||||
if (error != LLVMErrorSuccess) {
|
if (error != LLVMErrorSuccess) {
|
||||||
char *err_msg = LLVMGetErrorMessage(error);
|
char *err_msg = LLVMGetErrorMessage(error);
|
||||||
char buf[128];
|
char buf[128];
|
||||||
snprintf(buf, sizeof(buf), "failed to compile orc jit function: %s",
|
snprintf(buf, sizeof(buf),
|
||||||
err_msg);
|
"failed to compile orc jit function: %s\n", err_msg);
|
||||||
set_error_buf(error_buf, error_buf_size, buf);
|
set_error_buf(error_buf, error_buf_size, buf);
|
||||||
LLVMDisposeErrorMessage(err_msg);
|
LLVMDisposeErrorMessage(err_msg);
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user