Formatting fixes in libcoreint

This commit is contained in:
e.gavrin 2014-08-12 01:13:32 +04:00
parent d40c21b616
commit b3b1ba0206
3 changed files with 603 additions and 585 deletions

View File

@ -14,41 +14,42 @@
*/
#ifndef OPCODE_STRUCTURES_H
#define OPCODE_STRUCTURES_H
#define OPCODE_STRUCTURES_H
// Jerry bytecode ver:07/04/2014
#define OP_DEF(name, list) struct __op_##name { list ; } ;
#define OP_DEF(name, list) struct __op_##name { list ; } ;
#define OP_CODE_DECL_VOID(name) \
struct __op_##name { T_IDX __do_not_use; }; \
OPCODE getop_##name ( void );
OPCODE getop_##name (void);
#define OP_CODE_DECL(name, type, ... ) \
OP_DEF (name, type##_DECL( __VA_ARGS__ ) ) \
OPCODE getop_##name ( type );
#define OP_CODE_DECL(name, type, ...) \
OP_DEF (name, type##_DECL(__VA_ARGS__)) \
OPCODE getop_##name (type);
#define T_IDX_IDX T_IDX, T_IDX
#define T_IDX_IDX_IDX T_IDX, T_IDX, T_IDX
#define T_IDX_DECL(name) T_IDX name
#define T_IDX_IDX_DECL(name1, name2) \
T_IDX_DECL( name1 ) ; \
T_IDX_DECL( name2 )
T_IDX_DECL (name1) ; \
T_IDX_DECL (name2)
#define T_IDX_IDX_IDX_DECL(name1, name2, name3) \
T_IDX_DECL( name1 ) ; \
T_IDX_DECL( name2 ); \
T_IDX_DECL( name3 )
T_IDX_DECL (name1) ; \
T_IDX_DECL (name2); \
T_IDX_DECL (name3)
#define GETOP_IMPL_0(name) \
OPCODE getop_##name () { \
OPCODE getop_##name () \
{ \
OPCODE opdata; \
opdata.op_idx = __op__idx_##name; \
return opdata; \
}
#define GETOP_IMPL_1(name, field1) \
OPCODE getop_##name (T_IDX arg1) { \
OPCODE getop_##name (T_IDX arg1) \
{ \
OPCODE opdata; \
opdata.op_idx = __op__idx_##name; \
opdata.data.name.field1 = arg1; \
@ -56,7 +57,8 @@
}
#define GETOP_IMPL_2(name, field1, field2) \
OPCODE getop_##name (T_IDX arg1, T_IDX arg2) { \
OPCODE getop_##name (T_IDX arg1, T_IDX arg2) \
{ \
OPCODE opdata; \
opdata.op_idx = __op__idx_##name; \
opdata.data.name.field1 = arg1; \
@ -65,7 +67,8 @@
}
#define GETOP_IMPL_3(name, field1, field2, field3) \
OPCODE getop_##name (T_IDX arg1, T_IDX arg2, T_IDX arg3) { \
OPCODE getop_##name (T_IDX arg1, T_IDX arg2, T_IDX arg3) \
{ \
OPCODE opdata; \
opdata.op_idx = __op__idx_##name; \
opdata.data.name.field1 = arg1; \
@ -287,73 +290,73 @@ OP_CODE_DECL (assignment, T_IDX_IDX_IDX,
// Functions calls, declarations and argument handling
/** a = name(); */
/** a = name (); */
OP_CODE_DECL (call_0, T_IDX_IDX,
lhs,
name_lit_idx)
/** a = name(arg1); */
/** a = name (arg1); */
OP_CODE_DECL (call_1, T_IDX_IDX_IDX,
lhs,
name_lit_idx,
arg1_lit_idx)
/** a = name(arg1, ... */
/** a = name (arg1, ... */
OP_CODE_DECL (call_n, T_IDX_IDX_IDX,
lhs,
name_lit_idx,
arg1_lit_idx)
/** a = new name(); */
/** a = new name (); */
OP_CODE_DECL (construct_0, T_IDX_IDX,
lhs,
name_lit_idx)
/** a = new name(arg1); */
/** a = new name (arg1); */
OP_CODE_DECL (construct_1, T_IDX_IDX_IDX,
lhs,
name_lit_idx,
arg1_lit_idx)
/** a = new name(arg1, ... */
/** a = new name (arg1, ... */
OP_CODE_DECL (construct_n, T_IDX_IDX_IDX,
lhs,
name_lit_idx,
arg1_lit_idx)
/** name(); */
/** name (); */
OP_CODE_DECL (func_decl_0, T_IDX,
name_lit_idx)
/** name(arg1); */
/** name (arg1); */
OP_CODE_DECL (func_decl_1, T_IDX_IDX,
name_lit_idx,
arg1_lit_idx)
/** name(arg1, arg2); */
/** name (arg1, arg2); */
OP_CODE_DECL (func_decl_2, T_IDX_IDX_IDX,
name_lit_idx,
arg1_lit_idx,
arg2_lit_idx)
/** name(arg1, arg2, ... */
/** name (arg1, arg2, ... */
OP_CODE_DECL (func_decl_n, T_IDX_IDX_IDX,
name_lit_idx,
arg1_lit_idx,
arg2_lit_idx)
/** a = name(); */
/** a = name (); */
OP_CODE_DECL (func_expr_0, T_IDX_IDX,
lhs,
name_lit_idx)
/** a = name(arg1); */
/** a = name (arg1); */
OP_CODE_DECL (func_expr_1, T_IDX_IDX_IDX,
lhs,
name_lit_idx,
arg1_lit_idx)
/** a = name(arg1, ... */
/** a = name (arg1, ... */
OP_CODE_DECL (func_expr_n, T_IDX_IDX_IDX,
lhs,
name_lit_idx,
@ -484,7 +487,6 @@ OP_CODE_DECL (var_decl, T_IDX,
OP_CODE_DECL (reg_var_decl, T_IDX_IDX,
min,
max)
#endif /* OPCODE_STRUCTURES_H */
#endif /* OPCODE_STRUCTURES_H */

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@
*/
#ifndef OPCODES_H
#define OPCODES_H
#define OPCODES_H
#include "ecma-globals.h"
#include "globals.h"
@ -24,7 +24,7 @@ struct __int_data;
#define OP_STRUCT_FIELD(name) struct __op_##name name;
#define OP_ENUM_FIELD(name) __op__idx_##name ,
#define OP_FUNC_DECL(name) ecma_completion_value_t opfunc_##name (OPCODE, struct __int_data *);
#define OP_FUNC_DECL(name) ecma_completion_value_t opfunc_##name (OPCODE, struct __int_data *);
/** A single bytecode instruction is 32bit wide and has an 8bit opcode field
and several operand of 8 of 16 bit.*/
@ -33,9 +33,10 @@ struct __int_data;
#define T_IDX uint8_t /** index values */
OPCODE;
typedef ecma_completion_value_t (*opfunc)(OPCODE, struct __int_data *);
typedef
ecma_completion_value_t (*opfunc) (OPCODE, struct __int_data *);
#define OP_CALLS_AND_ARGS(op) \
#define OP_CALLS_AND_ARGS(op) \
op (call_0) \
op (call_1) \
op (call_n) \
@ -57,7 +58,7 @@ typedef ecma_completion_value_t (*opfunc)(OPCODE, struct __int_data *);
op (retval) \
op (ret)
#define OP_INITS(op) \
#define OP_INITS(op) \
op (array_0) \
op (array_1) \
op (array_2) \
@ -74,34 +75,34 @@ typedef ecma_completion_value_t (*opfunc)(OPCODE, struct __int_data *);
op (delete) \
op (typeof) \
op (with) \
op (end_with)
op (end_with)
#define OP_ASSIGNMENTS(op) \
#define OP_ASSIGNMENTS(op) \
op (assignment)
#define OP_B_SHIFTS(op) \
#define OP_B_SHIFTS(op) \
op (b_shift_left) \
op (b_shift_right) \
op (b_shift_uright)
#define OP_B_BITWISE(op) \
#define OP_B_BITWISE(op) \
op (b_and) \
op (b_or) \
op (b_xor) \
op (b_not)
#define OP_B_LOGICAL(op) \
#define OP_B_LOGICAL(op) \
op (logical_and) \
op (logical_or) \
op (logical_not)
#define OP_EQUALITY(op) \
#define OP_EQUALITY(op) \
op (equal_value) \
op (not_equal_value) \
op (equal_value_type) \
op (not_equal_value_type)
op (not_equal_value_type)
#define OP_RELATIONAL(op) \
#define OP_RELATIONAL(op) \
op (less_than) \
op (greater_than) \
op (less_or_equal_than) \
@ -109,7 +110,7 @@ typedef ecma_completion_value_t (*opfunc)(OPCODE, struct __int_data *);
op (instanceof) \
op (in)
#define OP_ARITHMETIC(op) \
#define OP_ARITHMETIC(op) \
op (post_incr) \
op (post_decr) \
op (pre_incr) \
@ -120,17 +121,17 @@ typedef ecma_completion_value_t (*opfunc)(OPCODE, struct __int_data *);
op (multiplication) \
op (remainder)
#define OP_UNCONDITIONAL_JUMPS(op) \
#define OP_UNCONDITIONAL_JUMPS(op) \
op (jmp) \
op (jmp_up) \
op (jmp_down) \
op (nop)
#define OP_UNARY_OPS(op) \
#define OP_UNARY_OPS(op) \
op (is_true_jmp) \
op (is_false_jmp)
#define OP_LIST(op) \
#define OP_LIST(op) \
OP_CALLS_AND_ARGS (op) \
OP_INITS (op) \
OP_ASSIGNMENTS (op) \
@ -180,5 +181,4 @@ typedef enum
OPCODE_ARG_TYPE_VARIABLE /**< index of variable name */
} opcode_arg_type_operand;
#endif /* OPCODES_H */
#endif /* OPCODES_H */