فهرست منبع

Fix issue and compilation warnings of new function call APIs (#383)

Xu Jun 5 سال پیش
والد
کامیت
2499e1ec4b
3فایلهای تغییر یافته به همراه8 افزوده شده و 6 حذف شده
  1. 2 1
      core/iwasm/aot/arch/aot_reloc_x86_64.c
  2. 5 4
      core/iwasm/common/wasm_runtime_common.c
  3. 1 1
      core/iwasm/compilation/aot_emit_aot_file.c

+ 2 - 1
core/iwasm/aot/arch/aot_reloc_x86_64.c

@@ -11,7 +11,8 @@
 #define R_X86_64_32     10  /* Direct 32 bit zero extended */
 #define R_X86_64_32     10  /* Direct 32 bit zero extended */
 #define R_X86_64_32S    11  /* Direct 32 bit sign extended */
 #define R_X86_64_32S    11  /* Direct 32 bit sign extended */
 
 
-#define IMAGE_REL_AMD64_REL32 4 /* The 32-bit relative address from the byte following the relocation. */
+#define IMAGE_REL_AMD64_REL32 4 /* The 32-bit relative address from
+                                   the byte following the relocation */
 
 
 void __divdi3();
 void __divdi3();
 void __udivdi3();
 void __udivdi3();

+ 5 - 4
core/iwasm/common/wasm_runtime_common.c

@@ -868,7 +868,7 @@ parse_args_to_uint32_array(WASMType *type,
                            uint32 num_args, wasm_val_t *args,
                            uint32 num_args, wasm_val_t *args,
                            uint32 *out_argv)
                            uint32 *out_argv)
 {
 {
-    int i, p;
+    uint32 i, p;
 
 
     for (i = 0, p = 0; i < num_args; i++) {
     for (i = 0, p = 0; i < num_args; i++) {
         switch (args[i].kind) {
         switch (args[i].kind) {
@@ -911,13 +911,13 @@ parse_uint32_array_to_results(WASMType *type,
                               uint32 argc, uint32 *argv,
                               uint32 argc, uint32 *argv,
                               wasm_val_t *out_results)
                               wasm_val_t *out_results)
 {
 {
-    int i, p;
+    uint32 i, p;
 
 
     for (i = 0, p = 0; i < type->result_count; i++) {
     for (i = 0, p = 0; i < type->result_count; i++) {
         switch (type->types[type->param_count + i]) {
         switch (type->types[type->param_count + i]) {
             case VALUE_TYPE_I32:
             case VALUE_TYPE_I32:
                 out_results[i].kind = WASM_I32;
                 out_results[i].kind = WASM_I32;
-                out_results[i].of.i32 = *(int32 *)argv[p++];
+                out_results[i].of.i32 = (int32)argv[p++];
                 break;
                 break;
             case VALUE_TYPE_I64:
             case VALUE_TYPE_I64:
             {
             {
@@ -1008,6 +1008,7 @@ wasm_runtime_call_wasm_a(WASMExecEnv *exec_env,
 
 
     ret_num = parse_uint32_array_to_results(type, type->ret_cell_num, argv, results);
     ret_num = parse_uint32_array_to_results(type, type->ret_cell_num, argv, results);
     bh_assert(ret_num == num_results);
     bh_assert(ret_num == num_results);
+    (void)ret_num;
 
 
 fail2:
 fail2:
     wasm_runtime_free(argv);
     wasm_runtime_free(argv);
@@ -1024,7 +1025,7 @@ wasm_runtime_call_wasm_v(WASMExecEnv *exec_env,
     wasm_val_t *args = NULL;
     wasm_val_t *args = NULL;
     WASMType *type = NULL;
     WASMType *type = NULL;
     bool ret = false;
     bool ret = false;
-    int i = 0;
+    uint32 i = 0;
     va_list vargs;
     va_list vargs;
 
 
 #if WASM_ENABLE_INTERP != 0
 #if WASM_ENABLE_INTERP != 0

+ 1 - 1
core/iwasm/compilation/aot_emit_aot_file.c

@@ -1540,7 +1540,7 @@ aot_resolve_target_info(AOTCompContext *comp_ctx, AOTObjectData *obj_data)
             obj_data->target_info.bin_type = AOT_COFF_BIN_TYPE;
             obj_data->target_info.bin_type = AOT_COFF_BIN_TYPE;
     }
     }
     else if (bin_type == LLVMBinaryTypeELF32L
     else if (bin_type == LLVMBinaryTypeELF32L
-        || bin_type == LLVMBinaryTypeELF32B) {
+             || bin_type == LLVMBinaryTypeELF32B) {
         struct elf32_ehdr *elf_header;
         struct elf32_ehdr *elf_header;
         bool is_little_bin = bin_type == LLVMBinaryTypeELF32L;
         bool is_little_bin = bin_type == LLVMBinaryTypeELF32L;