From 9a0b54313dd3ffc2de40fdaba3fa245199817f3f Mon Sep 17 00:00:00 2001 From: "e.gavrin" Date: Thu, 17 Jul 2014 13:08:43 +0400 Subject: [PATCH] remove opcodes --- src/libcoreint/opcode-structures.h | 46 ------------------------------ src/libcoreint/opcodes.c | 16 ----------- src/libcoreint/opcodes.h | 13 +-------- 3 files changed, 1 insertion(+), 74 deletions(-) diff --git a/src/libcoreint/opcode-structures.h b/src/libcoreint/opcode-structures.h index a745e1d4f..07415491c 100644 --- a/src/libcoreint/opcode-structures.h +++ b/src/libcoreint/opcode-structures.h @@ -74,52 +74,6 @@ return opdata; \ } -// All conditional jumps should be followed by a JMP instruction, which holds -// the target of conditional JMP. If condition is TRUE, than JMP to the target. -// Otherwise they fall through to the instruction after the JMP. -// if (true) { JMP } else { INSTR_AFTER_JMP } -// NOTE: We cannot swap L < R to R > L, because of floating-point semantics. - -/** L < R */ -OP_CODE_DECL (is_less_than, T_IDX_IDX, - value_left, - value_right) - -/** L <= R */ -OP_CODE_DECL (is_less_or_equal, T_IDX_IDX, - value_left, - value_right) - -/** L > R */ -OP_CODE_DECL (is_greater_than, T_IDX_IDX, - value_left, - value_right) - -/** L >= R */ -OP_CODE_DECL (is_greater_or_equal, T_IDX_IDX, - value_left, - value_right) - -/** L == R */ -OP_CODE_DECL (is_equal_value, T_IDX_IDX, - value_left, - value_right) - -/** L != R */ -OP_CODE_DECL (is_not_equal_value, T_IDX_IDX, - value_left, - value_right) - -/** L === R */ -OP_CODE_DECL (is_equal_value_type, T_IDX_IDX, - value_left, - value_right) - -/** L !== R */ -OP_CODE_DECL (is_not_equal_value_type, T_IDX_IDX, - value_left, - value_right) - /** Instruction tests if BOOLEAN value is TRUE and JMP to DST */ OP_CODE_DECL (is_true_jmp, T_IDX_IDX, value, diff --git a/src/libcoreint/opcodes.c b/src/libcoreint/opcodes.c index 8d5c68eee..abb07cef1 100644 --- a/src/libcoreint/opcodes.c +++ b/src/libcoreint/opcodes.c @@ -69,14 +69,6 @@ void opfunc_jmp_up (OPCODE opdata __unused, struct __int_data *int_data __unused void opfunc_jmp_down (OPCODE opdata __unused, struct __int_data *int_data __unused) { JERRY_UNREACHABLE (); } void opfunc_is_true_jmp (OPCODE opdata __unused, struct __int_data *int_data __unused) { JERRY_UNREACHABLE (); } void opfunc_is_false_jmp (OPCODE opdata __unused, struct __int_data *int_data __unused) { JERRY_UNREACHABLE (); } -void opfunc_is_less_than (OPCODE opdata __unused, struct __int_data *int_data __unused) { JERRY_UNREACHABLE (); } -void opfunc_is_less_or_equal (OPCODE opdata __unused, struct __int_data *int_data __unused) { JERRY_UNREACHABLE (); } -void opfunc_is_greater_than (OPCODE opdata __unused, struct __int_data *int_data __unused) { JERRY_UNREACHABLE (); } -void opfunc_is_greater_or_equal (OPCODE opdata __unused, struct __int_data *int_data __unused) { JERRY_UNREACHABLE (); } -void opfunc_is_equal_value (OPCODE opdata __unused, struct __int_data *int_data __unused) { JERRY_UNREACHABLE (); } -void opfunc_is_not_equal_value (OPCODE opdata __unused, struct __int_data *int_data __unused) { JERRY_UNREACHABLE (); } -void opfunc_is_equal_value_type (OPCODE opdata __unused, struct __int_data *int_data __unused) { JERRY_UNREACHABLE (); } -void opfunc_is_not_equal_value_type (OPCODE opdata __unused, struct __int_data *int_data __unused) { JERRY_UNREACHABLE (); } void opfunc_loop_inf (OPCODE opdata, struct __int_data *int_data) @@ -116,14 +108,6 @@ opfunc_jmp (OPCODE opdata, struct __int_data *int_data) } /** Opcode generators. */ -GETOP_IMPL_2 (is_less_than, value_left, value_right) -GETOP_IMPL_2 (is_less_or_equal, value_left, value_right) -GETOP_IMPL_2 (is_greater_than, value_left, value_right) -GETOP_IMPL_2 (is_greater_or_equal, value_left, value_right) -GETOP_IMPL_2 (is_equal_value, value_left, value_right) -GETOP_IMPL_2 (is_not_equal_value, value_left, value_right) -GETOP_IMPL_2 (is_equal_value_type, value_left, value_right) -GETOP_IMPL_2 (is_not_equal_value_type, value_left, value_right) GETOP_IMPL_2 (is_true_jmp, value, opcode) GETOP_IMPL_2 (is_false_jmp, value, opcode) GETOP_IMPL_1 (jmp, opcode_idx) diff --git a/src/libcoreint/opcodes.h b/src/libcoreint/opcodes.h index 1a303ee89..9cd396428 100644 --- a/src/libcoreint/opcodes.h +++ b/src/libcoreint/opcodes.h @@ -103,17 +103,6 @@ typedef void (*opfunc)(OPCODE, struct __int_data *); op(is_true_jmp) \ op(is_false_jmp) -#define OP_CONDITIONAL_JUMPS(op) \ - OP_UNARY_OPS(op) \ - op(is_less_than) \ - op(is_less_or_equal) \ - op(is_greater_than) \ - op(is_greater_or_equal) \ - op(is_equal_value) \ - op(is_not_equal_value) \ - op(is_equal_value_type) \ - op(is_not_equal_value_type) - #define OP_LIST(op) \ OP_LOOPS(op) \ OP_CALLS_AND_ARGS(op) \ @@ -125,7 +114,7 @@ typedef void (*opfunc)(OPCODE, struct __int_data *); OP_RELATIONAL(op) \ OP_ARITHMETIC(op) \ OP_UNCONDITIONAL_JUMPS(op) \ - OP_CONDITIONAL_JUMPS(op) + OP_UNARY_OPS(op) #include "opcode-structures.h"