Compare commits

..

No commits in common. "607ae47d7b1cc30d29a0396bdb9db022b8267124" and "9b9e938bee7b41f026fa9aeee988a5bfc63d55ed" have entirely different histories.

7 changed files with 25 additions and 52 deletions

View File

@ -4010,7 +4010,7 @@ wasm_runtime_get_import_type(WASMModuleCommon *const module, int32 import_index,
import_type->module_name = aot_import_table->module_name; import_type->module_name = aot_import_table->module_name;
import_type->name = aot_import_table->table_name; import_type->name = aot_import_table->table_name;
import_type->kind = WASM_IMPORT_EXPORT_KIND_TABLE; import_type->kind = WASM_IMPORT_EXPORT_KIND_TABLE;
import_type->linked = false; /* not supported */ import_type->linked = false;
import_type->u.table_type = import_type->u.table_type =
(WASMTableType *)&aot_import_table->table_type; (WASMTableType *)&aot_import_table->table_type;
return; return;
@ -4023,7 +4023,7 @@ wasm_runtime_get_import_type(WASMModuleCommon *const module, int32 import_index,
import_type->module_name = aot_import_memory->module_name; import_type->module_name = aot_import_memory->module_name;
import_type->name = aot_import_memory->memory_name; import_type->name = aot_import_memory->memory_name;
import_type->kind = WASM_IMPORT_EXPORT_KIND_MEMORY; import_type->kind = WASM_IMPORT_EXPORT_KIND_MEMORY;
import_type->linked = false; /* not supported */ import_type->linked = false;
import_type->u.memory_type = import_type->u.memory_type =
(WASMMemoryType *)&aot_import_memory->mem_type; (WASMMemoryType *)&aot_import_memory->mem_type;
return; return;

View File

@ -712,7 +712,7 @@ wasm_runtime_get_wasi_exit_code(wasm_module_inst_t module_inst);
* @return the function instance found, NULL if not found * @return the function instance found, NULL if not found
*/ */
WASM_RUNTIME_API_EXTERN wasm_function_inst_t WASM_RUNTIME_API_EXTERN wasm_function_inst_t
wasm_runtime_lookup_function(const wasm_module_inst_t module_inst, wasm_runtime_lookup_function(wasm_module_inst_t const module_inst,
const char *name); const char *name);
/** /**
@ -724,8 +724,8 @@ wasm_runtime_lookup_function(const wasm_module_inst_t module_inst,
* @return the parameter count of the function instance * @return the parameter count of the function instance
*/ */
WASM_RUNTIME_API_EXTERN uint32_t WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_get_param_count(const wasm_function_inst_t func_inst, wasm_func_get_param_count(wasm_function_inst_t const func_inst,
const wasm_module_inst_t module_inst); wasm_module_inst_t const module_inst);
/** /**
* Get result count of the function instance * Get result count of the function instance
@ -736,8 +736,8 @@ wasm_func_get_param_count(const wasm_function_inst_t func_inst,
* @return the result count of the function instance * @return the result count of the function instance
*/ */
WASM_RUNTIME_API_EXTERN uint32_t WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_get_result_count(const wasm_function_inst_t func_inst, wasm_func_get_result_count(wasm_function_inst_t const func_inst,
const wasm_module_inst_t module_inst); wasm_module_inst_t const module_inst);
/** /**
* Get parameter types of the function instance * Get parameter types of the function instance
@ -747,8 +747,8 @@ wasm_func_get_result_count(const wasm_function_inst_t func_inst,
* @param param_types the parameter types returned * @param param_types the parameter types returned
*/ */
WASM_RUNTIME_API_EXTERN void WASM_RUNTIME_API_EXTERN void
wasm_func_get_param_types(const wasm_function_inst_t func_inst, wasm_func_get_param_types(wasm_function_inst_t const func_inst,
const wasm_module_inst_t module_inst, wasm_module_inst_t const module_inst,
wasm_valkind_t *param_types); wasm_valkind_t *param_types);
/** /**
@ -759,8 +759,8 @@ wasm_func_get_param_types(const wasm_function_inst_t func_inst,
* @param result_types the result types returned * @param result_types the result types returned
*/ */
WASM_RUNTIME_API_EXTERN void WASM_RUNTIME_API_EXTERN void
wasm_func_get_result_types(const wasm_function_inst_t func_inst, wasm_func_get_result_types(wasm_function_inst_t const func_inst,
const wasm_module_inst_t module_inst, wasm_module_inst_t const module_inst,
wasm_valkind_t *result_types); wasm_valkind_t *result_types);
/** /**
@ -1314,7 +1314,7 @@ wasm_runtime_get_export_type(const wasm_module_t module, int32_t export_index,
* @return the number of parameters for the function type * @return the number of parameters for the function type
*/ */
WASM_RUNTIME_API_EXTERN uint32_t WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_type_get_param_count(const wasm_func_type_t func_type); wasm_func_type_get_param_count(wasm_func_type_t const func_type);
/** /**
* Get the kind of a parameter for a function type * Get the kind of a parameter for a function type
@ -1325,7 +1325,7 @@ wasm_func_type_get_param_count(const wasm_func_type_t func_type);
* @return the kind of the parameter if successful, -1 otherwise * @return the kind of the parameter if successful, -1 otherwise
*/ */
WASM_RUNTIME_API_EXTERN wasm_valkind_t WASM_RUNTIME_API_EXTERN wasm_valkind_t
wasm_func_type_get_param_valkind(const wasm_func_type_t func_type, wasm_func_type_get_param_valkind(wasm_func_type_t const func_type,
uint32_t param_index); uint32_t param_index);
/** /**
@ -1336,7 +1336,7 @@ wasm_func_type_get_param_valkind(const wasm_func_type_t func_type,
* @return the number of results for the function type * @return the number of results for the function type
*/ */
WASM_RUNTIME_API_EXTERN uint32_t WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_type_get_result_count(const wasm_func_type_t func_type); wasm_func_type_get_result_count(wasm_func_type_t const func_type);
/** /**
* Get the kind of a result for a function type * Get the kind of a result for a function type
@ -1347,7 +1347,7 @@ wasm_func_type_get_result_count(const wasm_func_type_t func_type);
* @return the kind of the result if successful, -1 otherwise * @return the kind of the result if successful, -1 otherwise
*/ */
WASM_RUNTIME_API_EXTERN wasm_valkind_t WASM_RUNTIME_API_EXTERN wasm_valkind_t
wasm_func_type_get_result_valkind(const wasm_func_type_t func_type, wasm_func_type_get_result_valkind(wasm_func_type_t const func_type,
uint32_t result_index); uint32_t result_index);
/** /**
@ -1817,7 +1817,7 @@ wasm_runtime_dump_pgo_prof_data_to_buf(wasm_module_inst_t module_inst,
* and name string) if found, NULL otherwise * and name string) if found, NULL otherwise
*/ */
WASM_RUNTIME_API_EXTERN const uint8_t * WASM_RUNTIME_API_EXTERN const uint8_t *
wasm_runtime_get_custom_section(const wasm_module_t module_comm, wasm_runtime_get_custom_section(wasm_module_t const module_comm,
const char *name, uint32_t *len); const char *name, uint32_t *len);
/** /**

View File

@ -49,15 +49,9 @@ os_dumps_proc_mem_info(char *out, unsigned int size)
void * void *
os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file) os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
{ {
void *addr; if ((uint64)size >= UINT32_MAX)
if (size >= UINT32_MAX)
return NULL; return NULL;
return BH_MALLOC((uint32)size);
if ((addr = BH_MALLOC((uint32)size)))
memset(addr, 0, (uint32)size);
return addr;
} }
void void

View File

@ -43,10 +43,8 @@ os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
uintptr_t *addr_field = buf_fixed - sizeof(uintptr_t); uintptr_t *addr_field = buf_fixed - sizeof(uintptr_t);
*addr_field = (uintptr_t)buf_origin; *addr_field = (uintptr_t)buf_origin;
#if (WASM_MEM_DUAL_BUS_MIRROR != 0) #if (WASM_MEM_DUAL_BUS_MIRROR != 0)
memset(buf_fixed + MEM_DUAL_BUS_OFFSET, 0, size);
return buf_fixed + MEM_DUAL_BUS_OFFSET; return buf_fixed + MEM_DUAL_BUS_OFFSET;
#else #else
memset(buf_fixed, 0, size);
return buf_fixed; return buf_fixed;
#endif #endif
} }
@ -73,7 +71,6 @@ os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
uintptr_t *addr_field = buf_fixed - sizeof(uintptr_t); uintptr_t *addr_field = buf_fixed - sizeof(uintptr_t);
*addr_field = (uintptr_t)buf_origin; *addr_field = (uintptr_t)buf_origin;
memset(buf_fixed, 0, size);
return buf_fixed; return buf_fixed;
} }
} }

View File

@ -52,15 +52,9 @@ os_dumps_proc_mem_info(char *out, unsigned int size)
void * void *
os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file) os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
{ {
void *addr; if (size > ((unsigned)~0))
if (size >= UINT32_MAX)
return NULL; return NULL;
return BH_MALLOC((unsigned)size);
if ((addr = BH_MALLOC((uint32)size)))
memset(addr, 0, (uint32)size);
return addr;
} }
void * void *
@ -94,4 +88,4 @@ os_dcache_flush(void)
void void
os_icache_flush(void *start, size_t len) os_icache_flush(void *start, size_t len)
{} {}

View File

@ -200,12 +200,7 @@ os_cond_wait(korp_cond *cond, korp_mutex *mutex)
void * void *
os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file) os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
{ {
void *addr; return rt_malloc(size);
if ((addr = rt_malloc(size)))
memset(addr, 0, size);
return addr;
} }
void void
@ -226,4 +221,4 @@ os_dcache_flush(void)
void void
os_icache_flush(void *start, size_t len) os_icache_flush(void *start, size_t len)
{} {}

View File

@ -179,19 +179,12 @@ strcspn(const char *s, const char *reject)
void * void *
os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file) os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
{ {
void *addr;
if ((uint64)size >= UINT32_MAX) if ((uint64)size >= UINT32_MAX)
return NULL; return NULL;
if (exec_mem_alloc_func) if (exec_mem_alloc_func)
addr = exec_mem_alloc_func((uint32)size); return exec_mem_alloc_func((uint32)size);
else else
addr = BH_MALLOC(size); return BH_MALLOC(size);
if (addr)
memset(addr, 0, size);
return addr;
} }
void * void *