]> granicus.if.org Git - php/commitdiff
cleanup
authorDmitry Stogov <dmitry@zend.com>
Tue, 17 Nov 2015 08:24:16 +0000 (11:24 +0300)
committerDmitry Stogov <dmitry@zend.com>
Tue, 17 Nov 2015 08:24:16 +0000 (11:24 +0300)
ext/opcache/Optimizer/block_pass.c
ext/opcache/Optimizer/pass3.c
ext/opcache/Optimizer/zend_optimizer_internal.h

index 931f780fdc94f8f7dc921c275c96d5b73b05f0a0..8627fa716e18d5b91a7fbe8a5028b38c6edf8d61 100644 (file)
@@ -924,16 +924,12 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
 
             if ((opline->opcode == ZEND_DIV || opline->opcode == ZEND_MOD) &&
                 zval_get_long(&ZEND_OP2_LITERAL(opline)) == 0) {
-                               if (RESULT_USED(opline)) {
-                                       SET_VAR_SOURCE(opline);
-                               }
+                               SET_VAR_SOURCE(opline);
                 opline++;
                                continue;
             } else if ((opline->opcode == ZEND_SL || opline->opcode == ZEND_SR) &&
                 zval_get_long(&ZEND_OP2_LITERAL(opline)) < 0) {
-                               if (RESULT_USED(opline)) {
-                                       SET_VAR_SOURCE(opline);
-                               }
+                               SET_VAR_SOURCE(opline);
                 opline++;
                                continue;
                        }
@@ -1057,7 +1053,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
                        MAKE_NOP(opline);
                }
                /* get variable source */
-               if (RESULT_USED(opline)) {
+               if (opline->result_type == IS_VAR || opline->result_type == IS_TMP_VAR) {
                        SET_VAR_SOURCE(opline);
                }
                if (opline->opcode != ZEND_NOP) {
index 0e6feea492d05f7ea67a3a99b6e01f11fb21f270..6aeaf8310ba5d337f573856b6a7d6d7f1730b6d2 100644 (file)
@@ -93,7 +93,7 @@ void zend_optimizer_pass3(zend_op_array *op_array)
                                                break;
                                        }
 
-                                       if ((ZEND_OP2_TYPE(opline) == IS_VAR || ZEND_OP2_TYPE(opline) == IS_CV)
+                                       if ((ZEND_OP2_TYPE(opline) & (IS_VAR | IS_CV))
                                                && ZEND_OP2(opline).var == ZEND_OP1(next_opline).var &&
                                                (opline->opcode == ZEND_ADD ||
                                                 opline->opcode == ZEND_MUL ||
@@ -112,7 +112,7 @@ void zend_optimizer_pass3(zend_op_array *op_array)
                                                        COPY_NODE(opline->op2, tmp);
                                                }
                                        }
-                                       if ((ZEND_OP1_TYPE(opline) == IS_VAR || ZEND_OP1_TYPE(opline) == IS_CV)
+                                       if ((ZEND_OP1_TYPE(opline) & (IS_VAR | IS_CV))
                                                && ZEND_OP1(opline).var == ZEND_OP1(next_opline).var
                                                && ZEND_OP1_TYPE(opline) == ZEND_OP1_TYPE(next_opline)) {
                                                switch (opline->opcode) {
index 414bc0a515b6685ef0aa38281b13f97d1aadbee2..60de459faa4b5d96af0a3fcd92175ff241afd950 100644 (file)
 #define INV_COND_EX(op)    ((op) == ZEND_JMPZ    ? ZEND_JMPNZ_EX : ZEND_JMPZ_EX)
 #define INV_EX_COND_EX(op) ((op) == ZEND_JMPZ_EX ? ZEND_JMPNZ_EX : ZEND_JMPZ_EX)
 
-#undef MAKE_NOP
-
-#define MAKE_NOP(opline) do { \
-       (opline)->op1.num = 0; \
-       (opline)->op2.num = 0; \
-       (opline)->result.num = 0; \
-       (opline)->opcode = ZEND_NOP; \
-       (opline)->op1_type =  IS_UNUSED; \
-       (opline)->op2_type = IS_UNUSED; \
-       (opline)->result_type = IS_UNUSED; \
-        zend_vm_set_opcode_handler(opline); \
-} while (0)
-
-#define RESULT_USED(op)            (((op->result_type & IS_VAR) && !(op->result_type & EXT_TYPE_UNUSED)) || op->result_type == IS_TMP_VAR)
 #define RESULT_UNUSED(op)      ((op->result_type & EXT_TYPE_UNUSED) != 0)
-#define SAME_VAR(op1, op2)  ((((op1 ## _type & IS_VAR) && (op2 ## _type & IS_VAR)) || (op1 ## _type == IS_TMP_VAR && op2 ## _type == IS_TMP_VAR)) && op1.var == op2.var)
+#define SAME_VAR(op1, op2)  (op1 ## _type == op2 ## _type && op1.var == op2.var)
 
 typedef struct _zend_optimizer_ctx {
        zend_arena             *arena;