Skip to content

Commit 60041ae

Browse files
committed
Apply clang-format for interpreter source files
1 parent 89c9e04 commit 60041ae

File tree

12 files changed

+9716
-9190
lines changed

12 files changed

+9716
-9190
lines changed

core/iwasm/common/wasm_runtime_common.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ extern "C" {
5757
#define STORE_PTR(addr, ptr) do { \
5858
*(void**)addr = (void*)ptr; \
5959
} while (0)
60-
#define LOAD_PTR(addr) (*(void**)(addr))
6160

6261
#else /* WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS != 0 */
6362

core/iwasm/interpreter/wasm.h

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extern "C" {
2424
#define VALUE_TYPE_EXTERNREF 0x6F
2525
#define VALUE_TYPE_VOID 0x40
2626
/* Used by AOT */
27-
#define VALUE_TYPE_I1 0x41
27+
#define VALUE_TYPE_I1 0x41
2828
/* Used by loader to represent any type of i32/i64/f32/f64 */
2929
#define VALUE_TYPE_ANY 0x42
3030

@@ -66,8 +66,8 @@ extern "C" {
6666
#endif
6767

6868
#define SUB_SECTION_TYPE_MODULE 0
69-
#define SUB_SECTION_TYPE_FUNC 1
70-
#define SUB_SECTION_TYPE_LOCAL 2
69+
#define SUB_SECTION_TYPE_FUNC 1
70+
#define SUB_SECTION_TYPE_LOCAL 2
7171

7272
#define IMPORT_KIND_FUNC 0
7373
#define IMPORT_KIND_TABLE 1
@@ -449,7 +449,7 @@ typedef struct WASMBranchBlock {
449449
* @return the aligned value
450450
*/
451451
inline static unsigned
452-
align_uint (unsigned v, unsigned b)
452+
align_uint(unsigned v, unsigned b)
453453
{
454454
unsigned m = b - 1;
455455
return (v + m) & ~m;
@@ -462,7 +462,7 @@ inline static uint32
462462
wasm_string_hash(const char *str)
463463
{
464464
unsigned h = (unsigned)strlen(str);
465-
const uint8 *p = (uint8*)str;
465+
const uint8 *p = (uint8 *)str;
466466
const uint8 *end = p + h;
467467

468468
while (p != end)
@@ -547,9 +547,10 @@ wasm_type_equal(const WASMType *type1, const WASMType *type2)
547547
return (type1->param_count == type2->param_count
548548
&& type1->result_count == type2->result_count
549549
&& memcmp(type1->types, type2->types,
550-
(uint32)(type1->param_count
551-
+ type1->result_count)) == 0)
552-
? true : false;
550+
(uint32)(type1->param_count + type1->result_count))
551+
== 0)
552+
? true
553+
: false;
553554
}
554555

555556
inline static uint32
@@ -566,8 +567,7 @@ wasm_get_smallest_type_idx(WASMType **types, uint32 type_count,
566567
}
567568

568569
static inline uint32
569-
block_type_get_param_types(BlockType *block_type,
570-
uint8 **p_param_types)
570+
block_type_get_param_types(BlockType *block_type, uint8 **p_param_types)
571571
{
572572
uint32 param_count = 0;
573573
if (!block_type->is_value_type) {
@@ -577,15 +577,14 @@ block_type_get_param_types(BlockType *block_type,
577577
}
578578
else {
579579
*p_param_types = NULL;
580-
param_count = 0;
580+
param_count = 0;
581581
}
582582

583583
return param_count;
584584
}
585585

586586
static inline uint32
587-
block_type_get_result_types(BlockType *block_type,
588-
uint8 **p_result_types)
587+
block_type_get_result_types(BlockType *block_type, uint8 **p_result_types)
589588
{
590589
uint32 result_count = 0;
591590
if (block_type->is_value_type) {

core/iwasm/interpreter/wasm_interp.h

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,43 +17,43 @@ struct WASMFunctionInstance;
1717
struct WASMExecEnv;
1818

1919
typedef struct WASMInterpFrame {
20-
/* The frame of the caller that are calling the current function. */
21-
struct WASMInterpFrame *prev_frame;
20+
/* The frame of the caller that are calling the current function. */
21+
struct WASMInterpFrame *prev_frame;
2222

23-
/* The current WASM function. */
24-
struct WASMFunctionInstance *function;
23+
/* The current WASM function. */
24+
struct WASMFunctionInstance *function;
2525

26-
/* Instruction pointer of the bytecode array. */
27-
uint8 *ip;
26+
/* Instruction pointer of the bytecode array. */
27+
uint8 *ip;
2828

2929
#if WASM_ENABLE_PERF_PROFILING != 0
30-
uint64 time_started;
30+
uint64 time_started;
3131
#endif
3232

3333
#if WASM_ENABLE_FAST_INTERP != 0
34-
/* return offset of the first return value of current frame.
35-
the callee will put return values here continuously */
36-
uint32 ret_offset;
37-
uint32 *lp;
38-
uint32 operand[1];
34+
/* Return offset of the first return value of current frame,
35+
the callee will put return values here continuously */
36+
uint32 ret_offset;
37+
uint32 *lp;
38+
uint32 operand[1];
3939
#else
40-
/* Operand stack top pointer of the current frame. The bottom of
41-
the stack is the next cell after the last local variable. */
42-
uint32 *sp_bottom;
43-
uint32 *sp_boundary;
44-
uint32 *sp;
40+
/* Operand stack top pointer of the current frame. The bottom of
41+
the stack is the next cell after the last local variable. */
42+
uint32 *sp_bottom;
43+
uint32 *sp_boundary;
44+
uint32 *sp;
4545

46-
WASMBranchBlock *csp_bottom;
47-
WASMBranchBlock *csp_boundary;
48-
WASMBranchBlock *csp;
46+
WASMBranchBlock *csp_bottom;
47+
WASMBranchBlock *csp_boundary;
48+
WASMBranchBlock *csp;
4949

50-
/* Frame data, the layout is:
51-
lp: param_cell_count + local_cell_count
52-
sp_bottom to sp_boundary: stack of data
53-
csp_bottom to csp_boundary: stack of block
54-
ref to frame end: data types of local vairables and stack data
55-
*/
56-
uint32 lp[1];
50+
/* Frame data, the layout is:
51+
lp: param_cell_count + local_cell_count
52+
sp_bottom to sp_boundary: stack of data
53+
csp_bottom to csp_boundary: stack of block
54+
ref to frame end: data types of local vairables and stack data
55+
*/
56+
uint32 lp[1];
5757
#endif
5858
} WASMInterpFrame;
5959

@@ -68,15 +68,15 @@ typedef struct WASMInterpFrame {
6868
static inline unsigned
6969
wasm_interp_interp_frame_size(unsigned all_cell_num)
7070
{
71-
return align_uint((uint32)offsetof(WASMInterpFrame, lp)
72-
+ all_cell_num * 5, 4);
71+
return align_uint((uint32)offsetof(WASMInterpFrame, lp) + all_cell_num * 5,
72+
4);
7373
}
7474

7575
void
7676
wasm_interp_call_wasm(struct WASMModuleInstance *module_inst,
7777
struct WASMExecEnv *exec_env,
78-
struct WASMFunctionInstance *function,
79-
uint32 argc, uint32 argv[]);
78+
struct WASMFunctionInstance *function, uint32 argc,
79+
uint32 argv[]);
8080

8181
#ifdef __cplusplus
8282
}

0 commit comments

Comments
 (0)