Apply clang-format for core/shared and product-mini files (#785)

Apply clang-format for core/shared and product-mini files
This commit is contained in:
Wenyong Huang
2021-10-14 09:12:07 +08:00
committed by GitHub
parent fb4afc7ca4
commit 17f62ad472
107 changed files with 3436 additions and 2898 deletions

View File

@ -60,6 +60,4 @@ os_getpagesize()
void
os_dcache_flush(void)
{
}
{}

View File

@ -53,15 +53,17 @@ typedef struct korp_cond {
os_thread_wait_list thread_wait_list;
} korp_cond;
unsigned os_getpagesize();
void *os_mem_commit(void *ptr, size_t size, int flags);
void os_mem_decommit(void *ptr, size_t size);
unsigned
os_getpagesize();
void *
os_mem_commit(void *ptr, size_t size, int flags);
void
os_mem_decommit(void *ptr, size_t size);
#define os_thread_local_attribute __declspec(thread)
#if WASM_DISABLE_HW_BOUND_CHECK == 0
#if defined(BUILD_TARGET_X86_64) \
|| defined(BUILD_TARGET_AMD_64)
#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64)
#include <setjmp.h>
@ -72,11 +74,14 @@ typedef jmp_buf korp_jmpbuf;
#define os_setjmp setjmp
#define os_longjmp longjmp
int os_thread_signal_init();
int
os_thread_signal_init();
void os_thread_signal_destroy();
void
os_thread_signal_destroy();
bool os_thread_signal_inited();
bool
os_thread_signal_inited();
#define os_signal_unmask() (void)0
#define os_sigreturn() (void)0
@ -89,4 +94,3 @@ bool os_thread_signal_inited();
#endif
#endif /* end of _PLATFORM_INTERNAL_H */

View File

@ -22,6 +22,3 @@ os_free(void *ptr)
{
free(ptr);
}

View File

@ -79,8 +79,7 @@ os_munmap(void *addr, size_t size)
}
}
#if TRACE_MEMMAP != 0
printf("Unmap memory, addr: %p, request_size: %zu\n",
addr, request_size);
printf("Unmap memory, addr: %p, request_size: %zu\n", addr, request_size);
#endif
}
@ -95,8 +94,8 @@ os_mem_commit(void *addr, size_t size, int flags)
return NULL;
#if TRACE_MEMMAP != 0
printf("Commit memory, addr: %p, request_size: %zu, protect: 0x%x\n",
addr, request_size, protect);
printf("Commit memory, addr: %p, request_size: %zu, protect: 0x%x\n", addr,
request_size, protect);
#endif
return VirtualAlloc((LPVOID)addr, request_size, MEM_COMMIT, protect);
}
@ -111,8 +110,8 @@ os_mem_decommit(void *addr, size_t size)
return;
#if TRACE_MEMMAP != 0
printf("Decommit memory, addr: %p, request_size: %zu\n",
addr, request_size);
printf("Decommit memory, addr: %p, request_size: %zu\n", addr,
request_size);
#endif
VirtualFree((LPVOID)addr, request_size, MEM_DECOMMIT);
}
@ -134,4 +133,3 @@ os_mprotect(void *addr, size_t size, int prot)
#endif
return VirtualProtect((LPVOID)addr, request_size, protect, NULL);
}

View File

@ -47,11 +47,16 @@ static os_thread_data supervisor_thread_data;
/* Thread data key */
static DWORD thread_data_key;
int os_sem_init(korp_sem* sem);
int os_sem_destroy(korp_sem* sem);
int os_sem_wait(korp_sem* sem);
int os_sem_reltimed_wait(korp_sem* sem, uint64 useconds);
int os_sem_signal(korp_sem* sem);
int
os_sem_init(korp_sem *sem);
int
os_sem_destroy(korp_sem *sem);
int
os_sem_wait(korp_sem *sem);
int
os_sem_reltimed_wait(korp_sem *sem, uint64 useconds);
int
os_sem_signal(korp_sem *sem);
int
os_thread_sys_init()
@ -141,8 +146,7 @@ os_thread_cleanup(void *retval)
BH_FREE(thread_data);
}
static unsigned __stdcall
os_thread_wrapper(void *arg)
static unsigned __stdcall os_thread_wrapper(void *arg)
{
os_thread_data *thread_data = arg;
os_thread_data *parent = thread_data->parent;
@ -202,9 +206,8 @@ os_thread_create_with_prio(korp_tid *p_tid, thread_start_routine_t start,
goto fail3;
os_mutex_lock(&parent->wait_lock);
if (!_beginthreadex(NULL, stack_size,
os_thread_wrapper, thread_data,
0, NULL)) {
if (!_beginthreadex(NULL, stack_size, os_thread_wrapper, thread_data, 0,
NULL)) {
os_mutex_unlock(&parent->wait_lock);
goto fail4;
}
@ -371,7 +374,7 @@ os_sem_wait(korp_sem *sem)
if (ret == WAIT_OBJECT_0)
return BHT_OK;
else if(ret == WAIT_TIMEOUT)
else if (ret == WAIT_TIMEOUT)
return (int)WAIT_TIMEOUT;
else /* WAIT_FAILED or others */
return BHT_ERROR;
@ -404,7 +407,7 @@ os_sem_reltimed_wait(korp_sem *sem, uint64 useconds)
if (ret == WAIT_OBJECT_0)
return BHT_OK;
else if(ret == WAIT_TIMEOUT)
else if (ret == WAIT_TIMEOUT)
return (int)WAIT_TIMEOUT;
else /* WAIT_FAILED or others */
return BHT_ERROR;
@ -414,8 +417,7 @@ int
os_sem_signal(korp_sem *sem)
{
bh_assert(sem);
return ReleaseSemaphore(*sem, 1, NULL) != FALSE
? BHT_OK: BHT_ERROR;
return ReleaseSemaphore(*sem, 1, NULL) != FALSE ? BHT_OK : BHT_ERROR;
}
int
@ -478,8 +480,8 @@ os_cond_destroy(korp_cond *cond)
}
static int
os_cond_wait_internal(korp_cond *cond, korp_mutex *mutex,
bool timed, uint64 useconds)
os_cond_wait_internal(korp_cond *cond, korp_mutex *mutex, bool timed,
uint64 useconds)
{
os_thread_wait_node *node = &thread_data_current()->wait_node;
@ -567,7 +569,7 @@ os_thread_get_stack_boundary()
GetCurrentThreadStackLimits(&low_limit, &high_limit);
/* 4 pages are set unaccessible by system, we reserved
one more page at least for safety */
thread_stack_boundary = (uint8*)(uintptr_t)low_limit + page_size * 5;
thread_stack_boundary = (uint8 *)(uintptr_t)low_limit + page_size * 5;
return thread_stack_boundary;
}
@ -601,4 +603,3 @@ os_thread_signal_inited()
return thread_signal_inited;
}
#endif

View File

@ -13,4 +13,3 @@ os_time_get_boot_microsecond()
return ((uint64)ts.tv_sec) * 1000 * 1000 + ((uint64)ts.tv_nsec) / 1000;
}