mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-02-11 09:25:20 +00:00
Fix inconsistent coding convention (#3171)
This commit is contained in:
parent
58c980c4df
commit
1429d8cc03
|
@ -6,7 +6,6 @@
|
|||
#include "wasm_runtime_common.h"
|
||||
#include "../interpreter/wasm_runtime.h"
|
||||
#include "../aot/aot_runtime.h"
|
||||
#include "bh_platform.h"
|
||||
#include "mem_alloc.h"
|
||||
#include "wasm_memory.h"
|
||||
|
||||
|
@ -53,11 +52,11 @@ align_as_and_cast(uint64 size, uint64 alignment)
|
|||
static bool
|
||||
wasm_memory_init_with_pool(void *mem, unsigned int bytes)
|
||||
{
|
||||
mem_allocator_t _allocator = mem_allocator_create(mem, bytes);
|
||||
mem_allocator_t allocator = mem_allocator_create(mem, bytes);
|
||||
|
||||
if (_allocator) {
|
||||
if (allocator) {
|
||||
memory_mode = MEMORY_MODE_POOL;
|
||||
pool_allocator = _allocator;
|
||||
pool_allocator = allocator;
|
||||
global_pool_size = bytes;
|
||||
return true;
|
||||
}
|
||||
|
@ -84,18 +83,18 @@ wasm_memory_init_with_allocator(void *_user_data, void *_malloc_func,
|
|||
}
|
||||
#else
|
||||
static bool
|
||||
wasm_memory_init_with_allocator(void *_malloc_func, void *_realloc_func,
|
||||
void *_free_func)
|
||||
wasm_memory_init_with_allocator(void *malloc_func_ptr, void *realloc_func_ptr,
|
||||
void *free_func_ptr)
|
||||
{
|
||||
if (_malloc_func && _free_func && _malloc_func != _free_func) {
|
||||
if (malloc_func_ptr && free_func_ptr && malloc_func_ptr != free_func_ptr) {
|
||||
memory_mode = MEMORY_MODE_ALLOCATOR;
|
||||
malloc_func = _malloc_func;
|
||||
realloc_func = _realloc_func;
|
||||
free_func = _free_func;
|
||||
malloc_func = malloc_func_ptr;
|
||||
realloc_func = realloc_func_ptr;
|
||||
free_func = free_func_ptr;
|
||||
return true;
|
||||
}
|
||||
LOG_ERROR("Init memory with allocator (%p, %p, %p) failed.\n", _malloc_func,
|
||||
_realloc_func, _free_func);
|
||||
LOG_ERROR("Init memory with allocator (%p, %p, %p) failed.\n",
|
||||
malloc_func_ptr, realloc_func_ptr, free_func_ptr);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -123,18 +122,13 @@ wasm_runtime_memory_init(mem_alloc_type_t mem_alloc_type,
|
|||
alloc_option->pool.heap_size);
|
||||
}
|
||||
else if (mem_alloc_type == Alloc_With_Allocator) {
|
||||
return wasm_memory_init_with_allocator(
|
||||
#if WASM_MEM_ALLOC_WITH_USER_DATA != 0
|
||||
return wasm_memory_init_with_allocator(
|
||||
alloc_option->allocator.user_data,
|
||||
alloc_option->allocator.malloc_func,
|
||||
alloc_option->allocator.realloc_func,
|
||||
alloc_option->allocator.free_func);
|
||||
#else
|
||||
return wasm_memory_init_with_allocator(
|
||||
alloc_option->allocator.malloc_func,
|
||||
alloc_option->allocator.realloc_func,
|
||||
alloc_option->allocator.free_func);
|
||||
#endif
|
||||
alloc_option->allocator.malloc_func,
|
||||
alloc_option->allocator.realloc_func,
|
||||
alloc_option->allocator.free_func);
|
||||
}
|
||||
else if (mem_alloc_type == Alloc_With_System_Allocator) {
|
||||
memory_mode = MEMORY_MODE_SYSTEM_ALLOCATOR;
|
||||
|
|
|
@ -3630,7 +3630,7 @@ wasm_runtime_invoke_native_raw(WASMExecEnv *exec_env, void *func_ptr,
|
|||
{
|
||||
WASMModuleInstanceCommon *module = wasm_runtime_get_module_inst(exec_env);
|
||||
typedef void (*NativeRawFuncPtr)(WASMExecEnv *, uint64 *);
|
||||
NativeRawFuncPtr invokeNativeRaw = (NativeRawFuncPtr)func_ptr;
|
||||
NativeRawFuncPtr invoke_native_raw = (NativeRawFuncPtr)func_ptr;
|
||||
uint64 argv_buf[16] = { 0 }, *argv1 = argv_buf, *argv_dst, size;
|
||||
uint32 *argv_src = argv, i, argc1, ptr_len;
|
||||
uint32 arg_i32;
|
||||
|
@ -3744,7 +3744,7 @@ wasm_runtime_invoke_native_raw(WASMExecEnv *exec_env, void *func_ptr,
|
|||
}
|
||||
|
||||
exec_env->attachment = attachment;
|
||||
invokeNativeRaw(exec_env, argv1);
|
||||
invoke_native_raw(exec_env, argv1);
|
||||
exec_env->attachment = NULL;
|
||||
|
||||
if (func_type->result_count > 0) {
|
||||
|
|
|
@ -232,14 +232,14 @@ destroy_wait_info(void *wait_info)
|
|||
}
|
||||
|
||||
static void
|
||||
map_try_release_wait_info(HashMap *wait_map_, AtomicWaitInfo *wait_info,
|
||||
map_try_release_wait_info(HashMap *wait_hash_map, AtomicWaitInfo *wait_info,
|
||||
void *address)
|
||||
{
|
||||
if (wait_info->wait_list->len > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
bh_hash_map_remove(wait_map_, address, NULL, NULL);
|
||||
bh_hash_map_remove(wait_hash_map, address, NULL, NULL);
|
||||
destroy_wait_info(wait_info);
|
||||
}
|
||||
|
||||
|
|
|
@ -1342,28 +1342,28 @@ exchange_uint32(uint8 *p_data)
|
|||
}
|
||||
|
||||
static void
|
||||
exchange_uint64(uint8 *pData)
|
||||
exchange_uint64(uint8 *p_data)
|
||||
{
|
||||
uint32 value;
|
||||
|
||||
value = *(uint32 *)pData;
|
||||
*(uint32 *)pData = *(uint32 *)(pData + 4);
|
||||
*(uint32 *)(pData + 4) = value;
|
||||
exchange_uint32(pData);
|
||||
exchange_uint32(pData + 4);
|
||||
value = *(uint32 *)p_data;
|
||||
*(uint32 *)p_data = *(uint32 *)(p_data + 4);
|
||||
*(uint32 *)(p_data + 4) = value;
|
||||
exchange_uint32(p_data);
|
||||
exchange_uint32(p_data + 4);
|
||||
}
|
||||
|
||||
static void
|
||||
exchange_uint128(uint8 *pData)
|
||||
exchange_uint128(uint8 *p_data)
|
||||
{
|
||||
/* swap high 64bit and low 64bit */
|
||||
uint64 value = *(uint64 *)pData;
|
||||
*(uint64 *)pData = *(uint64 *)(pData + 8);
|
||||
*(uint64 *)(pData + 8) = value;
|
||||
uint64 value = *(uint64 *)p_data;
|
||||
*(uint64 *)p_data = *(uint64 *)(p_data + 8);
|
||||
*(uint64 *)(p_data + 8) = value;
|
||||
/* exchange high 64bit */
|
||||
exchange_uint64(pData);
|
||||
exchange_uint64(p_data);
|
||||
/* exchange low 64bit */
|
||||
exchange_uint64(pData + 8);
|
||||
exchange_uint64(p_data + 8);
|
||||
}
|
||||
|
||||
static union {
|
||||
|
|
Loading…
Reference in New Issue
Block a user