Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
722b263
Merge pull request #406 from bytecodealliance/main
wenyongh Dec 2, 2021
2cb2120
Refine code when aux stack global isn't found
wenyongh Dec 2, 2021
ff31bfc
Merge pull request #407 from bytecodealliance/main
wenyongh Dec 3, 2021
973741d
Merge pull request #408 from bytecodealliance/main
wenyongh Dec 6, 2021
e39a9ec
Fix compilation error for target X86_32
wenyongh Dec 6, 2021
29c218e
Merge pull request #409 from bytecodealliance/main
wenyongh Dec 6, 2021
2e48be9
Implement relocation R_AARCH64_JUMP26 for aarch64
wenyongh Dec 6, 2021
857f00e
Merge pull request #410 from bytecodealliance/main
wenyongh Dec 7, 2021
84075cd
Merge pull request #414 from bytecodealliance/main
wenyongh Dec 8, 2021
eaf7aa8
Exclude IoT-APP-Store-Demo from coding guideline check
wenyongh Dec 8, 2021
ec10044
Merge pull request #413 from bytecodealliance/main
wenyongh Dec 8, 2021
e1f15e5
Fix SGX run XIP error
wenyongh Dec 8, 2021
f38cc26
Merge pull request #415 from bytecodealliance/main
wenyongh Dec 8, 2021
9cc7e27
Refine some codes and fix several issues
wenyongh Dec 9, 2021
7707a6a
Fix some shadow warnings
wenyongh Dec 9, 2021
5e30de5
Fix load table segment error
wenyongh Dec 10, 2021
04aa534
Fix code format
wenyongh Dec 10, 2021
021f52e
Fix wasm_value_type_size not handle VALUE_TYPE_VOID issue
wenyongh Dec 10, 2021
b7e06a2
Merge pull request #416 from bytecodealliance/main
wenyongh Dec 10, 2021
54df473
Fix wamrc endian/bit-width check invalid issue on win32 target
wenyongh Dec 11, 2021
27dc387
Merge pull request #421 from bytecodealliance/main
wenyongh Dec 15, 2021
6c8505f
Clear more compile warnings reported by -Wshadow flag
wenyongh Dec 15, 2021
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
2 changes: 1 addition & 1 deletion core/iwasm/aot/aot_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,7 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
bool ret;

if (argc < func_type->param_cell_num) {
char buf[128];
char buf[108];
snprintf(buf, sizeof(buf),
"invalid argument count %u, must be no smaller than %u", argc,
func_type->param_cell_num);
Expand Down
62 changes: 31 additions & 31 deletions core/iwasm/compilation/aot_emit_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,41 +74,41 @@ format_block_name(char *name, uint32 name_size, uint32 block_index,
#define SET_BUILDER_POS(llvm_block) \
LLVMPositionBuilderAtEnd(comp_ctx->builder, llvm_block)

#define CREATE_RESULT_VALUE_PHIS(block) \
do { \
if (block->result_count && !block->result_phis) { \
uint32 i; \
uint64 size; \
LLVMBasicBlockRef block_curr = CURR_BLOCK(); \
/* Allocate memory */ \
size = sizeof(LLVMValueRef) * (uint64)block->result_count; \
if (size >= UINT32_MAX \
|| !(block->result_phis = \
wasm_runtime_malloc((uint32)size))) { \
aot_set_last_error("allocate memory failed."); \
goto fail; \
} \
SET_BUILDER_POS(block->llvm_end_block); \
for (i = 0; i < block->result_count; i++) { \
if (!(block->result_phis[i] = LLVMBuildPhi( \
comp_ctx->builder, \
TO_LLVM_TYPE(block->result_types[i]), "phi"))) { \
aot_set_last_error("llvm build phi failed."); \
goto fail; \
} \
} \
SET_BUILDER_POS(block_curr); \
} \
#define CREATE_RESULT_VALUE_PHIS(block) \
do { \
if (block->result_count && !block->result_phis) { \
uint32 _i; \
uint64 _size; \
LLVMBasicBlockRef _block_curr = CURR_BLOCK(); \
/* Allocate memory */ \
_size = sizeof(LLVMValueRef) * (uint64)block->result_count; \
if (_size >= UINT32_MAX \
|| !(block->result_phis = \
wasm_runtime_malloc((uint32)_size))) { \
aot_set_last_error("allocate memory failed."); \
goto fail; \
} \
SET_BUILDER_POS(block->llvm_end_block); \
for (_i = 0; _i < block->result_count; _i++) { \
if (!(block->result_phis[_i] = LLVMBuildPhi( \
comp_ctx->builder, \
TO_LLVM_TYPE(block->result_types[_i]), "phi"))) { \
aot_set_last_error("llvm build phi failed."); \
goto fail; \
} \
} \
SET_BUILDER_POS(_block_curr); \
} \
} while (0)

#define ADD_TO_RESULT_PHIS(block, value, idx) \
do { \
LLVMBasicBlockRef block_curr = CURR_BLOCK(); \
LLVMBasicBlockRef _block_curr = CURR_BLOCK(); \
LLVMTypeRef phi_ty = LLVMTypeOf(block->result_phis[idx]); \
LLVMTypeRef value_ty = LLVMTypeOf(value); \
bh_assert(LLVMGetTypeKind(phi_ty) == LLVMGetTypeKind(value_ty)); \
bh_assert(LLVMGetTypeContext(phi_ty) == LLVMGetTypeContext(value_ty)); \
LLVMAddIncoming(block->result_phis[idx], &value, &block_curr, 1); \
LLVMAddIncoming(block->result_phis[idx], &value, &_block_curr, 1); \
(void)phi_ty; \
(void)value_ty; \
} while (0)
Expand All @@ -122,10 +122,10 @@ format_block_name(char *name, uint32 name_size, uint32 block_index,
} \
} while (0)

#define ADD_TO_PARAM_PHIS(block, value, idx) \
do { \
LLVMBasicBlockRef block_curr = CURR_BLOCK(); \
LLVMAddIncoming(block->param_phis[idx], &value, &block_curr, 1); \
#define ADD_TO_PARAM_PHIS(block, value, idx) \
do { \
LLVMBasicBlockRef _block_curr = CURR_BLOCK(); \
LLVMAddIncoming(block->param_phis[idx], &value, &_block_curr, 1); \
} while (0)

static LLVMBasicBlockRef
Expand Down
12 changes: 6 additions & 6 deletions core/iwasm/compilation/aot_emit_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
LLVMValueRef mem_base_addr, mem_check_bound;
LLVMBasicBlockRef block_curr = LLVMGetInsertBlock(comp_ctx->builder);
LLVMBasicBlockRef check_succ;
AOTValue *aot_value;
AOTValue *aot_value_top;
uint32 local_idx_of_aot_value = 0;
bool is_target_64bit, is_local_of_aot_value = false;
#if WASM_ENABLE_SHARED_MEMORY != 0
Expand Down Expand Up @@ -114,13 +114,13 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
}
}

aot_value =
aot_value_top =
func_ctx->block_stack.block_list_end->value_stack.value_list_end;
if (aot_value) {
/* aot_value is freed in the following POP_I32(addr),
if (aot_value_top) {
/* aot_value_top is freed in the following POP_I32(addr),
so save its fields here for further use */
is_local_of_aot_value = aot_value->is_local;
local_idx_of_aot_value = aot_value->local_idx;
is_local_of_aot_value = aot_value_top->is_local;
local_idx_of_aot_value = aot_value_top->local_idx;
}

POP_I32(addr);
Expand Down
8 changes: 4 additions & 4 deletions core/iwasm/compilation/aot_emit_variable.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ aot_compile_op_get_local(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
{
char name[32];
LLVMValueRef value;
AOTValue *aot_value;
AOTValue *aot_value_top;

CHECK_LOCAL(local_idx);

Expand All @@ -45,10 +45,10 @@ aot_compile_op_get_local(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,

PUSH(value, get_local_type(func_ctx, local_idx));

aot_value =
aot_value_top =
func_ctx->block_stack.block_list_end->value_stack.value_list_end;
aot_value->is_local = true;
aot_value->local_idx = local_idx;
aot_value_top->is_local = true;
aot_value_top->local_idx = local_idx;
return true;

fail:
Expand Down
7 changes: 4 additions & 3 deletions core/iwasm/compilation/aot_llvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1813,7 +1813,7 @@ aot_create_comp_context(AOTCompData *comp_data, aot_comp_option_t option)

if (option->enable_simd) {
char *tmp;
bool ret;
bool check_simd_ret;

comp_ctx->enable_simd = true;

Expand All @@ -1822,9 +1822,10 @@ aot_create_comp_context(AOTCompData *comp_data, aot_comp_option_t option)
goto fail;
}

ret = aot_check_simd_compatibility(comp_ctx->target_arch, tmp);
check_simd_ret =
aot_check_simd_compatibility(comp_ctx->target_arch, tmp);
LLVMDisposeMessage(tmp);
if (!ret) {
if (!check_simd_ret) {
aot_set_last_error("SIMD compatibility check failed, "
"try adding --cpu=<cpu> to specify a cpu "
"or adding --disable-simd to disable SIMD");
Expand Down
1 change: 0 additions & 1 deletion core/iwasm/interpreter/wasm_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,6 @@ load_init_expr(const uint8 **p_buf, const uint8 *buf_end,
#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0)
case INIT_EXPR_TYPE_V128_CONST:
{
uint8 flag;
uint64 high, low;

if (type != VALUE_TYPE_V128)
Expand Down