Formatting fixes in libcoreint
This commit is contained in:
@@ -14,41 +14,42 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef OPCODE_STRUCTURES_H
|
#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) \
|
#define OP_CODE_DECL_VOID(name) \
|
||||||
struct __op_##name { T_IDX __do_not_use; }; \
|
struct __op_##name { T_IDX __do_not_use; }; \
|
||||||
OPCODE getop_##name ( void );
|
OPCODE getop_##name (void);
|
||||||
|
|
||||||
#define OP_CODE_DECL(name, type, ... ) \
|
#define OP_CODE_DECL(name, type, ...) \
|
||||||
OP_DEF (name, type##_DECL( __VA_ARGS__ ) ) \
|
OP_DEF (name, type##_DECL(__VA_ARGS__)) \
|
||||||
OPCODE getop_##name ( type );
|
OPCODE getop_##name (type);
|
||||||
|
|
||||||
#define T_IDX_IDX T_IDX, T_IDX
|
#define T_IDX_IDX T_IDX, T_IDX
|
||||||
#define T_IDX_IDX_IDX T_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_DECL(name) T_IDX name
|
||||||
#define T_IDX_IDX_DECL(name1, name2) \
|
#define T_IDX_IDX_DECL(name1, name2) \
|
||||||
T_IDX_DECL( name1 ) ; \
|
T_IDX_DECL (name1) ; \
|
||||||
T_IDX_DECL( name2 )
|
T_IDX_DECL (name2)
|
||||||
#define T_IDX_IDX_IDX_DECL(name1, name2, name3) \
|
#define T_IDX_IDX_IDX_DECL(name1, name2, name3) \
|
||||||
T_IDX_DECL( name1 ) ; \
|
T_IDX_DECL (name1) ; \
|
||||||
T_IDX_DECL( name2 ); \
|
T_IDX_DECL (name2); \
|
||||||
T_IDX_DECL( name3 )
|
T_IDX_DECL (name3)
|
||||||
|
|
||||||
#define GETOP_IMPL_0(name) \
|
#define GETOP_IMPL_0(name) \
|
||||||
OPCODE getop_##name () { \
|
OPCODE getop_##name () \
|
||||||
|
{ \
|
||||||
OPCODE opdata; \
|
OPCODE opdata; \
|
||||||
opdata.op_idx = __op__idx_##name; \
|
opdata.op_idx = __op__idx_##name; \
|
||||||
return opdata; \
|
return opdata; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GETOP_IMPL_1(name, field1) \
|
#define GETOP_IMPL_1(name, field1) \
|
||||||
OPCODE getop_##name (T_IDX arg1) { \
|
OPCODE getop_##name (T_IDX arg1) \
|
||||||
|
{ \
|
||||||
OPCODE opdata; \
|
OPCODE opdata; \
|
||||||
opdata.op_idx = __op__idx_##name; \
|
opdata.op_idx = __op__idx_##name; \
|
||||||
opdata.data.name.field1 = arg1; \
|
opdata.data.name.field1 = arg1; \
|
||||||
@@ -56,7 +57,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define GETOP_IMPL_2(name, field1, field2) \
|
#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; \
|
OPCODE opdata; \
|
||||||
opdata.op_idx = __op__idx_##name; \
|
opdata.op_idx = __op__idx_##name; \
|
||||||
opdata.data.name.field1 = arg1; \
|
opdata.data.name.field1 = arg1; \
|
||||||
@@ -65,7 +67,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define GETOP_IMPL_3(name, field1, field2, field3) \
|
#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; \
|
OPCODE opdata; \
|
||||||
opdata.op_idx = __op__idx_##name; \
|
opdata.op_idx = __op__idx_##name; \
|
||||||
opdata.data.name.field1 = arg1; \
|
opdata.data.name.field1 = arg1; \
|
||||||
@@ -287,73 +290,73 @@ OP_CODE_DECL (assignment, T_IDX_IDX_IDX,
|
|||||||
|
|
||||||
// Functions calls, declarations and argument handling
|
// Functions calls, declarations and argument handling
|
||||||
|
|
||||||
/** a = name(); */
|
/** a = name (); */
|
||||||
OP_CODE_DECL (call_0, T_IDX_IDX,
|
OP_CODE_DECL (call_0, T_IDX_IDX,
|
||||||
lhs,
|
lhs,
|
||||||
name_lit_idx)
|
name_lit_idx)
|
||||||
|
|
||||||
/** a = name(arg1); */
|
/** a = name (arg1); */
|
||||||
OP_CODE_DECL (call_1, T_IDX_IDX_IDX,
|
OP_CODE_DECL (call_1, T_IDX_IDX_IDX,
|
||||||
lhs,
|
lhs,
|
||||||
name_lit_idx,
|
name_lit_idx,
|
||||||
arg1_lit_idx)
|
arg1_lit_idx)
|
||||||
|
|
||||||
/** a = name(arg1, ... */
|
/** a = name (arg1, ... */
|
||||||
OP_CODE_DECL (call_n, T_IDX_IDX_IDX,
|
OP_CODE_DECL (call_n, T_IDX_IDX_IDX,
|
||||||
lhs,
|
lhs,
|
||||||
name_lit_idx,
|
name_lit_idx,
|
||||||
arg1_lit_idx)
|
arg1_lit_idx)
|
||||||
|
|
||||||
/** a = new name(); */
|
/** a = new name (); */
|
||||||
OP_CODE_DECL (construct_0, T_IDX_IDX,
|
OP_CODE_DECL (construct_0, T_IDX_IDX,
|
||||||
lhs,
|
lhs,
|
||||||
name_lit_idx)
|
name_lit_idx)
|
||||||
|
|
||||||
/** a = new name(arg1); */
|
/** a = new name (arg1); */
|
||||||
OP_CODE_DECL (construct_1, T_IDX_IDX_IDX,
|
OP_CODE_DECL (construct_1, T_IDX_IDX_IDX,
|
||||||
lhs,
|
lhs,
|
||||||
name_lit_idx,
|
name_lit_idx,
|
||||||
arg1_lit_idx)
|
arg1_lit_idx)
|
||||||
|
|
||||||
/** a = new name(arg1, ... */
|
/** a = new name (arg1, ... */
|
||||||
OP_CODE_DECL (construct_n, T_IDX_IDX_IDX,
|
OP_CODE_DECL (construct_n, T_IDX_IDX_IDX,
|
||||||
lhs,
|
lhs,
|
||||||
name_lit_idx,
|
name_lit_idx,
|
||||||
arg1_lit_idx)
|
arg1_lit_idx)
|
||||||
|
|
||||||
/** name(); */
|
/** name (); */
|
||||||
OP_CODE_DECL (func_decl_0, T_IDX,
|
OP_CODE_DECL (func_decl_0, T_IDX,
|
||||||
name_lit_idx)
|
name_lit_idx)
|
||||||
|
|
||||||
/** name(arg1); */
|
/** name (arg1); */
|
||||||
OP_CODE_DECL (func_decl_1, T_IDX_IDX,
|
OP_CODE_DECL (func_decl_1, T_IDX_IDX,
|
||||||
name_lit_idx,
|
name_lit_idx,
|
||||||
arg1_lit_idx)
|
arg1_lit_idx)
|
||||||
|
|
||||||
/** name(arg1, arg2); */
|
/** name (arg1, arg2); */
|
||||||
OP_CODE_DECL (func_decl_2, T_IDX_IDX_IDX,
|
OP_CODE_DECL (func_decl_2, T_IDX_IDX_IDX,
|
||||||
name_lit_idx,
|
name_lit_idx,
|
||||||
arg1_lit_idx,
|
arg1_lit_idx,
|
||||||
arg2_lit_idx)
|
arg2_lit_idx)
|
||||||
|
|
||||||
/** name(arg1, arg2, ... */
|
/** name (arg1, arg2, ... */
|
||||||
OP_CODE_DECL (func_decl_n, T_IDX_IDX_IDX,
|
OP_CODE_DECL (func_decl_n, T_IDX_IDX_IDX,
|
||||||
name_lit_idx,
|
name_lit_idx,
|
||||||
arg1_lit_idx,
|
arg1_lit_idx,
|
||||||
arg2_lit_idx)
|
arg2_lit_idx)
|
||||||
|
|
||||||
/** a = name(); */
|
/** a = name (); */
|
||||||
OP_CODE_DECL (func_expr_0, T_IDX_IDX,
|
OP_CODE_DECL (func_expr_0, T_IDX_IDX,
|
||||||
lhs,
|
lhs,
|
||||||
name_lit_idx)
|
name_lit_idx)
|
||||||
|
|
||||||
/** a = name(arg1); */
|
/** a = name (arg1); */
|
||||||
OP_CODE_DECL (func_expr_1, T_IDX_IDX_IDX,
|
OP_CODE_DECL (func_expr_1, T_IDX_IDX_IDX,
|
||||||
lhs,
|
lhs,
|
||||||
name_lit_idx,
|
name_lit_idx,
|
||||||
arg1_lit_idx)
|
arg1_lit_idx)
|
||||||
|
|
||||||
/** a = name(arg1, ... */
|
/** a = name (arg1, ... */
|
||||||
OP_CODE_DECL (func_expr_n, T_IDX_IDX_IDX,
|
OP_CODE_DECL (func_expr_n, T_IDX_IDX_IDX,
|
||||||
lhs,
|
lhs,
|
||||||
name_lit_idx,
|
name_lit_idx,
|
||||||
@@ -486,5 +489,4 @@ OP_CODE_DECL (reg_var_decl, T_IDX_IDX,
|
|||||||
max)
|
max)
|
||||||
|
|
||||||
|
|
||||||
#endif /* OPCODE_STRUCTURES_H */
|
#endif /* OPCODE_STRUCTURES_H */
|
||||||
|
|
||||||
|
|||||||
+535
-519
File diff suppressed because it is too large
Load Diff
+17
-17
@@ -14,7 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef OPCODES_H
|
#ifndef OPCODES_H
|
||||||
#define OPCODES_H
|
#define OPCODES_H
|
||||||
|
|
||||||
#include "ecma-globals.h"
|
#include "ecma-globals.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
@@ -24,7 +24,7 @@ struct __int_data;
|
|||||||
|
|
||||||
#define OP_STRUCT_FIELD(name) struct __op_##name name;
|
#define OP_STRUCT_FIELD(name) struct __op_##name name;
|
||||||
#define OP_ENUM_FIELD(name) __op__idx_##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
|
/** A single bytecode instruction is 32bit wide and has an 8bit opcode field
|
||||||
and several operand of 8 of 16 bit.*/
|
and several operand of 8 of 16 bit.*/
|
||||||
@@ -33,9 +33,10 @@ struct __int_data;
|
|||||||
#define T_IDX uint8_t /** index values */
|
#define T_IDX uint8_t /** index values */
|
||||||
|
|
||||||
OPCODE;
|
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_0) \
|
||||||
op (call_1) \
|
op (call_1) \
|
||||||
op (call_n) \
|
op (call_n) \
|
||||||
@@ -57,7 +58,7 @@ typedef ecma_completion_value_t (*opfunc)(OPCODE, struct __int_data *);
|
|||||||
op (retval) \
|
op (retval) \
|
||||||
op (ret)
|
op (ret)
|
||||||
|
|
||||||
#define OP_INITS(op) \
|
#define OP_INITS(op) \
|
||||||
op (array_0) \
|
op (array_0) \
|
||||||
op (array_1) \
|
op (array_1) \
|
||||||
op (array_2) \
|
op (array_2) \
|
||||||
@@ -76,32 +77,32 @@ typedef ecma_completion_value_t (*opfunc)(OPCODE, struct __int_data *);
|
|||||||
op (with) \
|
op (with) \
|
||||||
op (end_with)
|
op (end_with)
|
||||||
|
|
||||||
#define OP_ASSIGNMENTS(op) \
|
#define OP_ASSIGNMENTS(op) \
|
||||||
op (assignment)
|
op (assignment)
|
||||||
|
|
||||||
#define OP_B_SHIFTS(op) \
|
#define OP_B_SHIFTS(op) \
|
||||||
op (b_shift_left) \
|
op (b_shift_left) \
|
||||||
op (b_shift_right) \
|
op (b_shift_right) \
|
||||||
op (b_shift_uright)
|
op (b_shift_uright)
|
||||||
|
|
||||||
#define OP_B_BITWISE(op) \
|
#define OP_B_BITWISE(op) \
|
||||||
op (b_and) \
|
op (b_and) \
|
||||||
op (b_or) \
|
op (b_or) \
|
||||||
op (b_xor) \
|
op (b_xor) \
|
||||||
op (b_not)
|
op (b_not)
|
||||||
|
|
||||||
#define OP_B_LOGICAL(op) \
|
#define OP_B_LOGICAL(op) \
|
||||||
op (logical_and) \
|
op (logical_and) \
|
||||||
op (logical_or) \
|
op (logical_or) \
|
||||||
op (logical_not)
|
op (logical_not)
|
||||||
|
|
||||||
#define OP_EQUALITY(op) \
|
#define OP_EQUALITY(op) \
|
||||||
op (equal_value) \
|
op (equal_value) \
|
||||||
op (not_equal_value) \
|
op (not_equal_value) \
|
||||||
op (equal_value_type) \
|
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 (less_than) \
|
||||||
op (greater_than) \
|
op (greater_than) \
|
||||||
op (less_or_equal_than) \
|
op (less_or_equal_than) \
|
||||||
@@ -109,7 +110,7 @@ typedef ecma_completion_value_t (*opfunc)(OPCODE, struct __int_data *);
|
|||||||
op (instanceof) \
|
op (instanceof) \
|
||||||
op (in)
|
op (in)
|
||||||
|
|
||||||
#define OP_ARITHMETIC(op) \
|
#define OP_ARITHMETIC(op) \
|
||||||
op (post_incr) \
|
op (post_incr) \
|
||||||
op (post_decr) \
|
op (post_decr) \
|
||||||
op (pre_incr) \
|
op (pre_incr) \
|
||||||
@@ -120,17 +121,17 @@ typedef ecma_completion_value_t (*opfunc)(OPCODE, struct __int_data *);
|
|||||||
op (multiplication) \
|
op (multiplication) \
|
||||||
op (remainder)
|
op (remainder)
|
||||||
|
|
||||||
#define OP_UNCONDITIONAL_JUMPS(op) \
|
#define OP_UNCONDITIONAL_JUMPS(op) \
|
||||||
op (jmp) \
|
op (jmp) \
|
||||||
op (jmp_up) \
|
op (jmp_up) \
|
||||||
op (jmp_down) \
|
op (jmp_down) \
|
||||||
op (nop)
|
op (nop)
|
||||||
|
|
||||||
#define OP_UNARY_OPS(op) \
|
#define OP_UNARY_OPS(op) \
|
||||||
op (is_true_jmp) \
|
op (is_true_jmp) \
|
||||||
op (is_false_jmp)
|
op (is_false_jmp)
|
||||||
|
|
||||||
#define OP_LIST(op) \
|
#define OP_LIST(op) \
|
||||||
OP_CALLS_AND_ARGS (op) \
|
OP_CALLS_AND_ARGS (op) \
|
||||||
OP_INITS (op) \
|
OP_INITS (op) \
|
||||||
OP_ASSIGNMENTS (op) \
|
OP_ASSIGNMENTS (op) \
|
||||||
@@ -180,5 +181,4 @@ typedef enum
|
|||||||
OPCODE_ARG_TYPE_VARIABLE /**< index of variable name */
|
OPCODE_ARG_TYPE_VARIABLE /**< index of variable name */
|
||||||
} opcode_arg_type_operand;
|
} opcode_arg_type_operand;
|
||||||
|
|
||||||
#endif /* OPCODES_H */
|
#endif /* OPCODES_H */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user