Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion core/iwasm/compilation/aot_compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ typedef enum FloatArithmetic {
#define INT64_PTR_TYPE comp_ctx->basic_types.int64_ptr_type
#define F32_PTR_TYPE comp_ctx->basic_types.float32_ptr_type
#define F64_PTR_TYPE comp_ctx->basic_types.float64_ptr_type
#define VOID_PTR_TYPE comp_ctx->basic_types.void_ptr_type

#define I32_CONST(v) LLVMConstInt(I32_TYPE, v, true)
#define I64_CONST(v) LLVMConstInt(I64_TYPE, v, true)
Expand Down
4 changes: 2 additions & 2 deletions core/iwasm/compilation/aot_emit_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ aot_compile_op_memory_grow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)

/* To be simple, call wasm_runtime_set_exception() no matter
enlarge success or not */
param_types[1] = VOID_PTR_TYPE;
param_types[1] = INT8_PTR_TYPE;
ret_type = VOID_TYPE;
if (!(func_type = LLVMFunctionType(ret_type, param_types, 2, false))) {
aot_set_last_error("llvm add function type failed.");
Expand Down Expand Up @@ -614,7 +614,7 @@ aot_compile_op_memory_grow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
}

/* Call function wasm_runtime_set_exception(aot_inst, NULL) */
param_values[1] = LLVMConstNull(VOID_PTR_TYPE);
param_values[1] = LLVMConstNull(INT8_PTR_TYPE);
CHECK_LLVM_CONST(param_values[1]);
if (!(LLVMBuildCall(comp_ctx->builder, func, param_values, 2, ""))) {
aot_set_last_error("llvm build call failed.");
Expand Down
45 changes: 0 additions & 45 deletions core/iwasm/compilation/aot_llvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,45 +359,6 @@ create_cur_exception(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
return true;
}

static bool
create_func_ptrs(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
{
LLVMValueRef offset, func_ptrs_ptr;
LLVMTypeRef void_ptr_type;

offset = I32_CONST(offsetof(AOTModuleInstance, func_ptrs.ptr));
func_ptrs_ptr = LLVMBuildInBoundsGEP(comp_ctx->builder,
func_ctx->aot_inst,
&offset, 1,
"func_ptrs_ptr");
if (!func_ptrs_ptr) {
aot_set_last_error("llvm build in bounds gep failed.");
return false;
}

if (!(void_ptr_type = LLVMPointerType(VOID_PTR_TYPE, 0))
|| !(void_ptr_type = LLVMPointerType(void_ptr_type, 0))) {
aot_set_last_error("llvm get pointer type failed.");
return false;
}

func_ctx->func_ptrs = LLVMBuildBitCast(comp_ctx->builder, func_ptrs_ptr,
void_ptr_type, "func_ptrs_tmp");
if (!func_ctx->func_ptrs) {
aot_set_last_error("llvm build bit cast failed.");
return false;
}

func_ctx->func_ptrs = LLVMBuildLoad(comp_ctx->builder, func_ctx->func_ptrs,
"func_ptrs");
if (!func_ctx->func_ptrs) {
aot_set_last_error("llvm build load failed.");
return false;
}

return true;
}

static bool
create_func_type_indexes(AOTCompContext *comp_ctx,
AOTFuncContext *func_ctx)
Expand Down Expand Up @@ -636,10 +597,6 @@ aot_create_func_context(AOTCompData *comp_data, AOTCompContext *comp_ctx,
if (!create_cur_exception(comp_ctx, func_ctx))
goto fail;

/* Load function pointers */
if (!create_func_ptrs(comp_ctx, func_ctx))
goto fail;

/* Load function type indexes */
if (!create_func_type_indexes(comp_ctx, func_ctx))
goto fail;
Expand Down Expand Up @@ -723,15 +680,13 @@ aot_set_llvm_basic_types(AOTLLVMTypes *basic_types, LLVMContextRef context)
basic_types->int64_ptr_type = LLVMPointerType(basic_types->int64_type, 0);
basic_types->float32_ptr_type = LLVMPointerType(basic_types->float32_type, 0);
basic_types->float64_ptr_type = LLVMPointerType(basic_types->float64_type, 0);
basic_types->void_ptr_type = LLVMPointerType(basic_types->void_type, 0);

return (basic_types->int8_ptr_type
&& basic_types->int16_ptr_type
&& basic_types->int32_ptr_type
&& basic_types->int64_ptr_type
&& basic_types->float32_ptr_type
&& basic_types->float64_ptr_type
&& basic_types->void_ptr_type
&& basic_types->meta_data_type) ? true : false;
}

Expand Down
2 changes: 0 additions & 2 deletions core/iwasm/compilation/aot_llvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ typedef struct AOTFuncContext {
LLVMBasicBlockRef got_exception_block;
LLVMBasicBlockRef func_return_block;
LLVMValueRef exception_id_phi;
LLVMValueRef func_ptrs;
LLVMValueRef func_type_indexes;
LLVMValueRef locals[1];
} AOTFuncContext;
Expand All @@ -143,7 +142,6 @@ typedef struct AOTLLVMTypes {
LLVMTypeRef int64_ptr_type;
LLVMTypeRef float32_ptr_type;
LLVMTypeRef float64_ptr_type;
LLVMTypeRef void_ptr_type;

LLVMTypeRef meta_data_type;
} AOTLLVMTypes;
Expand Down