Apply clang-format for more src files and update spec test script (#775)

Apply clang-format for core/iwasm/include, core/iwasm/common and
core/iwasm/aot files.

Update spec cases test script:
- Checkout latest commit of https://github.com/WebAssembly/spec
- Checkout main branch but not master of https://github.com/WebAssembly/threads
- Update wabt to latest version

And update source debugging document.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
Wenyong Huang
2021-10-08 17:47:11 +08:00
committed by GitHub
parent 6415e1b006
commit 52b6c73d9c
37 changed files with 2835 additions and 2875 deletions

View File

@ -95,6 +95,7 @@ typedef struct AOTFunctionInstance {
} AOTFunctionInstance;
#if defined(OS_ENABLE_HW_BOUND_CHECK) && defined(BH_PLATFORM_WINDOWS)
/* clang-format off */
typedef struct AOTUnwindInfo {
uint8 Version : 3;
uint8 Flags : 5;
@ -111,6 +112,7 @@ typedef struct AOTUnwindInfo {
uint16 FrameOffset;
} UnwindCode[1];
} AOTUnwindInfo;
/* clang-format on */
/* size of mov instruction and jmp instruction */
#define PLT_ITEM_SIZE 12
@ -328,7 +330,7 @@ typedef struct AOTModuleInstance {
* TODO: for now we treate imported table like a local table
*/
uint32 table_count;
/* points to global_data */
/* points to global_data */
AOTPointer global_data;
/* points to AOTTableInstance[] */
AOTPointer tables;
@ -373,15 +375,15 @@ typedef struct AOTModuleInstance {
/* reserved */
uint32 reserved[6];
/*
* +------------------------------+ <-- memories.ptr
* | #0 AOTMemoryInstance
* +------------------------------+ <-- global_data.ptr
* | global data
* +------------------------------+ <-- tables.ptr
* | AOTTableInstance[table_count]
* +------------------------------+
*/
/*
* +------------------------------+ <-- memories.ptr
* | #0 AOTMemoryInstance
* +------------------------------+ <-- global_data.ptr
* | global data
* +------------------------------+ <-- tables.ptr
* | AOTTableInstance[table_count]
* +------------------------------+
*/
union {
uint64 _make_it_8_byte_aligned_;
AOTMemoryInstance memory_instances[1];
@ -409,8 +411,7 @@ typedef struct AOTTargetInfo {
char arch[16];
} AOTTargetInfo;
typedef struct AOTFuncPerfProfInfo
{
typedef struct AOTFuncPerfProfInfo {
/* total execution time */
uint64 total_exec_time;
/* total execution count */
@ -436,9 +437,9 @@ typedef struct AOTFrame {
*
* @return return AOT module loaded, NULL if failed
*/
AOTModule*
aot_load_from_aot_file(const uint8 *buf, uint32 size,
char *error_buf, uint32 error_buf_size);
AOTModule *
aot_load_from_aot_file(const uint8 *buf, uint32 size, char *error_buf,
uint32 error_buf_size);
/**
* Load a AOT module from a specified AOT section list.
@ -449,9 +450,9 @@ aot_load_from_aot_file(const uint8 *buf, uint32 size,
*
* @return return AOT module loaded, NULL if failed
*/
AOTModule*
aot_load_from_sections(AOTSection *section_list,
char *error_buf, uint32 error_buf_size);
AOTModule *
aot_load_from_sections(AOTSection *section_list, char *error_buf,
uint32 error_buf_size);
#if WASM_ENABLE_JIT != 0
/**
@ -463,9 +464,9 @@ aot_load_from_sections(AOTSection *section_list,
*
* @return return AOT module loaded, NULL if failed
*/
AOTModule*
aot_convert_wasm_module(WASMModule *wasm_module,
char *error_buf, uint32 error_buf_size);
AOTModule *
aot_convert_wasm_module(WASMModule *wasm_module, char *error_buf,
uint32 error_buf_size);
#endif
/**
@ -490,10 +491,9 @@ aot_unload(AOTModule *module);
*
* @return return the instantiated AOT module instance, NULL if failed
*/
AOTModuleInstance*
aot_instantiate(AOTModule *module, bool is_sub_inst,
uint32 stack_size, uint32 heap_size,
char *error_buf, uint32 error_buf_size);
AOTModuleInstance *
aot_instantiate(AOTModule *module, bool is_sub_inst, uint32 stack_size,
uint32 heap_size, char *error_buf, uint32 error_buf_size);
/**
* Deinstantiate a AOT module instance, destroy the resources.
@ -514,9 +514,9 @@ aot_deinstantiate(AOTModuleInstance *module_inst, bool is_sub_inst);
*
* @return the function instance found
*/
AOTFunctionInstance*
aot_lookup_function(const AOTModuleInstance *module_inst,
const char *name, const char *signature);
AOTFunctionInstance *
aot_lookup_function(const AOTModuleInstance *module_inst, const char *name,
const char *signature);
/**
* Call the given AOT function of a AOT module instance with
* arguments.
@ -533,8 +533,7 @@ aot_lookup_function(const AOTModuleInstance *module_inst,
* the caller can call aot_get_exception to get exception info.
*/
bool
aot_call_function(WASMExecEnv *exec_env,
AOTFunctionInstance *function,
aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
unsigned argc, uint32 argv[]);
bool
@ -553,12 +552,10 @@ aot_create_exec_env_singleton(AOTModuleInstance *module_inst);
* @param exception current exception string
*/
void
aot_set_exception(AOTModuleInstance *module_inst,
const char *exception);
aot_set_exception(AOTModuleInstance *module_inst, const char *exception);
void
aot_set_exception_with_id(AOTModuleInstance *module_inst,
uint32 id);
aot_set_exception_with_id(AOTModuleInstance *module_inst, uint32 id);
/**
* Get exception info of the AOT module instance.
@ -567,7 +564,7 @@ aot_set_exception_with_id(AOTModuleInstance *module_inst,
*
* @return the exception string
*/
const char*
const char *
aot_get_exception(AOTModuleInstance *module_inst);
/**
@ -583,24 +580,23 @@ aot_module_malloc(AOTModuleInstance *module_inst, uint32 size,
void **p_native_addr);
uint32
aot_module_realloc(AOTModuleInstance *module_inst, uint32 ptr,
uint32 size, void **p_native_addr);
aot_module_realloc(AOTModuleInstance *module_inst, uint32 ptr, uint32 size,
void **p_native_addr);
void
aot_module_free(AOTModuleInstance *module_inst, uint32 ptr);
uint32
aot_module_dup_data(AOTModuleInstance *module_inst,
const char *src, uint32 size);
aot_module_dup_data(AOTModuleInstance *module_inst, const char *src,
uint32 size);
bool
aot_validate_app_addr(AOTModuleInstance *module_inst,
uint32 app_offset, uint32 size);
aot_validate_app_addr(AOTModuleInstance *module_inst, uint32 app_offset,
uint32 size);
bool
aot_validate_native_addr(AOTModuleInstance *module_inst,
void *native_ptr, uint32 size);
aot_validate_native_addr(AOTModuleInstance *module_inst, void *native_ptr,
uint32 size);
void *
aot_addr_app_to_native(AOTModuleInstance *module_inst, uint32 app_offset);
@ -609,14 +605,11 @@ uint32
aot_addr_native_to_app(AOTModuleInstance *module_inst, void *native_ptr);
bool
aot_get_app_addr_range(AOTModuleInstance *module_inst,
uint32 app_offset,
uint32 *p_app_start_offset,
uint32 *p_app_end_offset);
aot_get_app_addr_range(AOTModuleInstance *module_inst, uint32 app_offset,
uint32 *p_app_start_offset, uint32 *p_app_end_offset);
bool
aot_get_native_addr_range(AOTModuleInstance *module_inst,
uint8 *native_ptr,
aot_get_native_addr_range(AOTModuleInstance *module_inst, uint8 *native_ptr,
uint8 **p_native_start_addr,
uint8 **p_native_end_addr);
@ -633,19 +626,18 @@ aot_enlarge_memory(AOTModuleInstance *module_inst, uint32 inc_page_count);
* @return true if equal, false otherwise
*/
bool
aot_is_wasm_type_equal(AOTModuleInstance *module_inst,
uint32 type1_idx, uint32 type2_idx);
aot_is_wasm_type_equal(AOTModuleInstance *module_inst, uint32 type1_idx,
uint32 type2_idx);
/**
* Invoke native function from aot code
*/
bool
aot_invoke_native(WASMExecEnv *exec_env, uint32 func_idx,
uint32 argc, uint32 *argv);
aot_invoke_native(WASMExecEnv *exec_env, uint32 func_idx, uint32 argc,
uint32 *argv);
bool
aot_call_indirect(WASMExecEnv *exec_env,
uint32 tbl_idx, uint32 table_elem_idx,
aot_call_indirect(WASMExecEnv *exec_env, uint32 tbl_idx, uint32 table_elem_idx,
uint32 argc, uint32 *argv);
uint32
@ -659,8 +651,8 @@ aot_memset(void *s, int c, size_t n);
#if WASM_ENABLE_BULK_MEMORY != 0
bool
aot_memory_init(AOTModuleInstance *module_inst, uint32 seg_index,
uint32 offset, uint32 len, uint32 dst);
aot_memory_init(AOTModuleInstance *module_inst, uint32 seg_index, uint32 offset,
uint32 len, uint32 dst);
bool
aot_data_drop(AOTModuleInstance *module_inst, uint32 seg_index);
@ -668,12 +660,10 @@ aot_data_drop(AOTModuleInstance *module_inst, uint32 seg_index);
#if WASM_ENABLE_THREAD_MGR != 0
bool
aot_set_aux_stack(WASMExecEnv *exec_env,
uint32 start_offset, uint32 size);
aot_set_aux_stack(WASMExecEnv *exec_env, uint32 start_offset, uint32 size);
bool
aot_get_aux_stack(WASMExecEnv *exec_env,
uint32 *start_offset, uint32 *size);
aot_get_aux_stack(WASMExecEnv *exec_env, uint32 *start_offset, uint32 *size);
#endif
#ifdef OS_ENABLE_HW_BOUND_CHECK
@ -697,18 +687,18 @@ void
aot_drop_table_seg(AOTModuleInstance *module_inst, uint32 tbl_seg_idx);
void
aot_table_init(AOTModuleInstance *module_inst,
uint32 tbl_idx, uint32 tbl_seg_idx,
uint32 length, uint32 src_offset, uint32 dst_offset);
aot_table_init(AOTModuleInstance *module_inst, uint32 tbl_idx,
uint32 tbl_seg_idx, uint32 length, uint32 src_offset,
uint32 dst_offset);
void
aot_table_copy(AOTModuleInstance *module_inst,
uint32 src_tbl_idx, uint32 dst_tbl_idx,
uint32 length, uint32 src_offset, uint32 dst_offset);
aot_table_copy(AOTModuleInstance *module_inst, uint32 src_tbl_idx,
uint32 dst_tbl_idx, uint32 length, uint32 src_offset,
uint32 dst_offset);
void
aot_table_fill(AOTModuleInstance *module_inst, uint32 tbl_idx,
uint32 length, uint32 val, uint32 data_offset);
aot_table_fill(AOTModuleInstance *module_inst, uint32 tbl_idx, uint32 length,
uint32 val, uint32 data_offset);
uint32
aot_table_grow(AOTModuleInstance *module_inst, uint32 tbl_idx,
@ -735,4 +725,3 @@ aot_dump_perf_profiling(const AOTModuleInstance *module_inst);
#endif
#endif /* end of _AOT_RUNTIME_H_ */