Fix some compilation warnings and enable Windows JIT (#586)
This commit is contained in:
@ -574,7 +574,7 @@ load_table_init_data_list(const uint8 **p_buf, const uint8 *buf_end,
|
||||
data_list[i]->offset.init_expr_type = (uint8)init_expr_type;
|
||||
data_list[i]->offset.u.i64 = (int64)init_expr_value;
|
||||
data_list[i]->func_index_count = func_index_count;
|
||||
read_byte_array(buf, buf_end, data_list[i]->func_indexes, size1);
|
||||
read_byte_array(buf, buf_end, data_list[i]->func_indexes, (uint32)size1);
|
||||
}
|
||||
|
||||
*p_buf = buf;
|
||||
@ -1444,7 +1444,7 @@ do_text_relocation(AOTModule *module,
|
||||
bh_memcpy_s(xmm_buf, sizeof(xmm_buf),
|
||||
symbol + strlen(XMM_PLT_PREFIX) + 16, 16);
|
||||
if (!str2uint64(xmm_buf, (uint64*)symbol_addr)) {
|
||||
set_error_buf_v(error_buf, error_buf,
|
||||
set_error_buf_v(error_buf, error_buf_size,
|
||||
"resolve symbol %s failed", symbol);
|
||||
goto check_symbol_fail;
|
||||
}
|
||||
@ -1452,7 +1452,7 @@ do_text_relocation(AOTModule *module,
|
||||
bh_memcpy_s(xmm_buf, sizeof(xmm_buf),
|
||||
symbol + strlen(XMM_PLT_PREFIX), 16);
|
||||
if (!str2uint64(xmm_buf, (uint64*)((uint8*)symbol_addr + 8))) {
|
||||
set_error_buf_v(error_buf, error_buf,
|
||||
set_error_buf_v(error_buf, error_buf_size,
|
||||
"resolve symbol %s failed", symbol);
|
||||
goto check_symbol_fail;
|
||||
}
|
||||
@ -1468,7 +1468,7 @@ do_text_relocation(AOTModule *module,
|
||||
bh_memcpy_s(real_buf, sizeof(real_buf),
|
||||
symbol + strlen(REAL_PLT_PREFIX), 16);
|
||||
if (!str2uint64(real_buf, (uint64*)symbol_addr)) {
|
||||
set_error_buf_v(error_buf, error_buf,
|
||||
set_error_buf_v(error_buf, error_buf_size,
|
||||
"resolve symbol %s failed", symbol);
|
||||
goto check_symbol_fail;
|
||||
}
|
||||
@ -1484,7 +1484,7 @@ do_text_relocation(AOTModule *module,
|
||||
bh_memcpy_s(float_buf, sizeof(float_buf),
|
||||
symbol + strlen(REAL_PLT_PREFIX), 8);
|
||||
if (!str2uint32(float_buf, (uint32*)symbol_addr)) {
|
||||
set_error_buf_v(error_buf, error_buf,
|
||||
set_error_buf_v(error_buf, error_buf_size,
|
||||
"resolve symbol %s failed", symbol);
|
||||
goto check_symbol_fail;
|
||||
}
|
||||
@ -2306,7 +2306,8 @@ aot_load_from_comp_data(AOTCompData *comp_data, AOTCompContext *comp_ctx,
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
bh_memcpy_s(module->memories, size, comp_data->memories, size);
|
||||
bh_memcpy_s(module->memories, (uint32)size,
|
||||
comp_data->memories, (uint32)size);
|
||||
}
|
||||
|
||||
module->mem_init_data_list = comp_data->mem_init_data_list;
|
||||
|
||||
@ -777,7 +777,7 @@ wasm_runtime_deinstantiate_internal(WASMModuleInstanceCommon *module_inst,
|
||||
void
|
||||
wasm_runtime_deinstantiate(WASMModuleInstanceCommon *module_inst)
|
||||
{
|
||||
return wasm_runtime_deinstantiate_internal(module_inst, false);
|
||||
wasm_runtime_deinstantiate_internal(module_inst, false);
|
||||
}
|
||||
|
||||
WASMExecEnv *
|
||||
@ -1962,7 +1962,7 @@ wasm_runtime_init_wasi(WASMModuleInstanceCommon *module_inst,
|
||||
|
||||
fail:
|
||||
if (envp)
|
||||
wasm_runtime_free(envp);
|
||||
wasm_runtime_free((void*)envp);
|
||||
|
||||
if (init_options.preopens)
|
||||
wasm_runtime_free(init_options.preopens);
|
||||
|
||||
@ -83,7 +83,7 @@ aot_compile_simd_i8x16_arith(AOTCompContext *comp_ctx,
|
||||
|
||||
return simd_v128_integer_arith(comp_ctx, func_ctx, arith_op, lhs, rhs);
|
||||
fail:
|
||||
return NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -105,7 +105,7 @@ aot_compile_simd_i16x8_arith(AOTCompContext *comp_ctx,
|
||||
|
||||
return simd_v128_integer_arith(comp_ctx, func_ctx, arith_op, lhs, rhs);
|
||||
fail:
|
||||
return NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -127,7 +127,7 @@ aot_compile_simd_i32x4_arith(AOTCompContext *comp_ctx,
|
||||
|
||||
return simd_v128_integer_arith(comp_ctx, func_ctx, arith_op, lhs, rhs);
|
||||
fail:
|
||||
return NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@ -1909,8 +1909,8 @@ wasm_enlarge_memory(WASMModuleInstance *module, uint32 inc_page_count)
|
||||
return false;
|
||||
|
||||
memory_data = memory->memory_data;
|
||||
heap_size = memory->heap_data_end - memory->heap_data;
|
||||
total_size_old = memory->memory_data_end - memory_data;
|
||||
heap_size = (uint32)(memory->heap_data_end - memory->heap_data);
|
||||
total_size_old = (uint32)(memory->memory_data_end - memory_data);
|
||||
total_page_count = inc_page_count + memory->cur_page_count;
|
||||
total_size = memory->num_bytes_per_page * (uint64)total_page_count;
|
||||
heap_data_old = memory->heap_data;
|
||||
|
||||
@ -647,7 +647,7 @@ static uint32
|
||||
strcpy_wrapper(wasm_exec_env_t exec_env, char *dst, const char *src)
|
||||
{
|
||||
wasm_module_inst_t module_inst = get_module_inst(exec_env);
|
||||
uint32 len = strlen(src) + 1;
|
||||
uint32 len = (uint32)strlen(src) + 1;
|
||||
|
||||
/* src has been checked by runtime */
|
||||
if (!validate_native_addr(dst, len))
|
||||
@ -712,7 +712,7 @@ free_wrapper(wasm_exec_env_t exec_env, void *ptr)
|
||||
if (!validate_native_addr(ptr, sizeof(uint32)))
|
||||
return;
|
||||
|
||||
return module_free(addr_native_to_app(ptr));
|
||||
module_free(addr_native_to_app(ptr));
|
||||
}
|
||||
|
||||
static int32
|
||||
|
||||
@ -6,12 +6,14 @@
|
||||
#include "bh_vector.h"
|
||||
|
||||
static uint8*
|
||||
alloc_vector_data(uint32 length, uint32 size_elem)
|
||||
alloc_vector_data(size_t length, size_t size_elem)
|
||||
{
|
||||
uint64 total_size = ((uint64)size_elem) * length;
|
||||
uint8 *data;
|
||||
|
||||
if (total_size > UINT32_MAX) {
|
||||
if (length > UINT32_MAX
|
||||
|| size_elem > UINT32_MAX
|
||||
|| total_size > UINT32_MAX) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -23,7 +25,7 @@ alloc_vector_data(uint32 length, uint32 size_elem)
|
||||
}
|
||||
|
||||
static bool
|
||||
extend_vector(Vector *vector, uint32 length)
|
||||
extend_vector(Vector *vector, size_t length)
|
||||
{
|
||||
uint8 *data;
|
||||
|
||||
@ -45,7 +47,7 @@ extend_vector(Vector *vector, uint32 length)
|
||||
}
|
||||
|
||||
bool
|
||||
bh_vector_init(Vector *vector, uint32 init_length, uint32 size_elem)
|
||||
bh_vector_init(Vector *vector, size_t init_length, size_t size_elem)
|
||||
{
|
||||
if (!vector) {
|
||||
LOG_ERROR("Init vector failed: vector is NULL.\n");
|
||||
@ -104,7 +106,7 @@ bool bh_vector_get(const Vector *vector, uint32 index, void *elem_buf)
|
||||
|
||||
bool bh_vector_insert(Vector *vector, uint32 index, const void *elem_buf)
|
||||
{
|
||||
uint32 i;
|
||||
size_t i;
|
||||
uint8 *p;
|
||||
|
||||
if (!vector || !elem_buf) {
|
||||
@ -182,7 +184,7 @@ bh_vector_remove(Vector *vector, uint32 index, void *old_elem_buf)
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32
|
||||
size_t
|
||||
bh_vector_size(const Vector *vector)
|
||||
{
|
||||
return vector ? vector->num_elems : 0;
|
||||
|
||||
@ -35,7 +35,7 @@ typedef struct Vector {
|
||||
* @return true if success, false otherwise
|
||||
*/
|
||||
bool
|
||||
bh_vector_init(Vector *vector, uint32 init_length, uint32 size_elem);
|
||||
bh_vector_init(Vector *vector, size_t init_length, size_t size_elem);
|
||||
|
||||
/**
|
||||
* Set element of vector
|
||||
@ -104,7 +104,7 @@ bh_vector_remove(Vector *vector, uint32 index, void *old_elem_buf);
|
||||
*
|
||||
* @return return the size of the vector
|
||||
*/
|
||||
uint32
|
||||
size_t
|
||||
bh_vector_size(const Vector *vector);
|
||||
|
||||
/**
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
#ifndef __GNUC__
|
||||
|
||||
#include "bh_getopt.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
char* optarg = NULL;
|
||||
@ -14,7 +15,6 @@ int optind = 1;
|
||||
int getopt(int argc, char *const argv[], const char *optstring)
|
||||
{
|
||||
static int sp = 1;
|
||||
int c;
|
||||
int opt;
|
||||
char *p;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user