com php-src: Combine conditions: Zend/zend_compile.c ext/ opcache/Optimizer/block_pass.c ext/opcache/Optimizer/zend _dfg.c
ext/opcache/Optimizer/zend_dump.c ext/opcach e/Optimizer/zend_ssa.c
| From: | Dmitry Stogov | Date: | Thu, 11 Feb 2016 20:11:19 +0000 |
| Subject: | com php-src: Combine conditions: Zend/zend_compile.c ext/ opcache/Optimizer/block_pass.c ext/opcache/Optimizer/zend _dfg.c ext/opcache/Optimizer/zend_dump.c ext/opcach e/Optimizer/zend_ssa.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-90994@lists.php.net to get a copy of this message | ||
Commit: 8c2d55962e2265cabfdf74d4072478f55d3cf6ab
Author: Dmitry Stogov <dmitry@zend.com> Thu, 11 Feb 2016 23:11:19 +0300
Parents: 5faedf5b3e05f0a8c226ac15d90be3d9ade38518
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8c2d55962e2265cabfdf74d4072478f55d3cf6ab
Log:
Combine conditions
Changed paths:
M Zend/zend_compile.c
M ext/opcache/Optimizer/block_pass.c
M ext/opcache/Optimizer/zend_dfg.c
M ext/opcache/Optimizer/zend_dump.c
M ext/opcache/Optimizer/zend_ssa.c
Diff:
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index bc871ed..01135ec 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -3834,7 +3834,7 @@ static int zend_handle_loops_and_finally_ex(zend_long depth) /* {{{ */
} else {
zend_op *opline;
- ZEND_ASSERT(loop_var->var_type == IS_VAR || loop_var->var_type == IS_TMP_VAR);
+ ZEND_ASSERT(loop_var->var_type & (IS_VAR|IS_TMP_VAR));
opline = get_next_op(CG(active_op_array));
opline->opcode = loop_var->opcode;
opline->op1_type = loop_var->var_type;
@@ -4363,7 +4363,7 @@ void zend_compile_switch(zend_ast *ast) /* {{{ */
zend_end_loop(get_next_op_number(CG(active_op_array)), &expr_node);
- if (expr_node.op_type == IS_VAR || expr_node.op_type == IS_TMP_VAR) {
+ if (expr_node.op_type & (IS_VAR|IS_TMP_VAR)) {
/* don't use emit_op() to prevent automatic live-range construction */
opline = get_next_op(CG(active_op_array));
opline->opcode = ZEND_FREE;
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index 665515d..b582ef5 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -749,7 +749,7 @@ optimize_const_unary_op:
}
/* get variable source */
- if (opline->result_type == IS_VAR || opline->result_type == IS_TMP_VAR) {
+ if (opline->result_type & (IS_VAR|IS_TMP_VAR)) {
SET_VAR_SOURCE(opline);
}
opline++;
@@ -1504,7 +1504,7 @@ static void zend_t_usage(zend_cfg *cfg, zend_op_array *op_array, zend_bitset
use
}
while (opline<end) {
- if (opline->op1_type == IS_VAR || opline->op1_type == IS_TMP_VAR) {
+ if (opline->op1_type & (IS_VAR|IS_TMP_VAR)) {
var_num = VAR_NUM(opline->op1.var);
if (!zend_bitset_in(defined_here, var_num)) {
zend_bitset_incl(used_ext, var_num);
@@ -1670,7 +1670,7 @@ static void zend_t_usage(zend_cfg *cfg, zend_op_array *op_array, zend_bitset
use
zend_bitset_incl(usage, VAR_NUM(opline->op2.var));
}
- if (opline->op1_type == IS_VAR || opline->op1_type == IS_TMP_VAR) {
+ if (opline->op1_type & (IS_VAR|IS_TMP_VAR)) {
zend_bitset_incl(usage, VAR_NUM(opline->op1.var));
}
diff --git a/ext/opcache/Optimizer/zend_dfg.c b/ext/opcache/Optimizer/zend_dfg.c
index 704b84e..e72afd1 100644
--- a/ext/opcache/Optimizer/zend_dfg.c
+++ b/ext/opcache/Optimizer/zend_dfg.c
@@ -135,8 +135,7 @@ op1_use:
DFG_SET(use, set_size, j, EX_VAR_TO_NUM(opline->op1.var));
}
}
- } else if (opline->op1_type == IS_VAR ||
- opline->op1_type == IS_TMP_VAR) {
+ } else if (opline->op1_type & (IS_VAR|IS_TMP_VAR)) {
if (!DFG_ISSET(def, set_size, j, EX_VAR_TO_NUM(opline->op1.var))) {
DFG_SET(use, set_size, j, EX_VAR_TO_NUM(opline->op1.var));
}
@@ -171,8 +170,7 @@ op2_use:
}
break;
}
- } else if (opline->op2_type == IS_VAR ||
- opline->op2_type == IS_TMP_VAR) {
+ } else if (opline->op2_type & (IS_VAR|IS_TMP_VAR)) {
if (opline->opcode == ZEND_FE_FETCH_R || opline->opcode == ZEND_FE_FETCH_RW) {
if (!DFG_ISSET(use, set_size, j, EX_VAR_TO_NUM(opline->op2.var))) {
DFG_SET(def, set_size, j, EX_VAR_TO_NUM(opline->op2.var));
@@ -189,8 +187,7 @@ op2_use:
DFG_SET(def, set_size, j, EX_VAR_TO_NUM(opline->result.var));
}
DFG_SET(gen, set_size, j, EX_VAR_TO_NUM(opline->result.var));
- } else if (opline->result_type == IS_VAR ||
- opline->result_type == IS_TMP_VAR) {
+ } else if (opline->result_type & (IS_VAR|IS_TMP_VAR)) {
if (!DFG_ISSET(use, set_size, j, EX_VAR_TO_NUM(opline->result.var))) {
DFG_SET(def, set_size, j, EX_VAR_TO_NUM(opline->result.var));
}
diff --git a/ext/opcache/Optimizer/zend_dump.c b/ext/opcache/Optimizer/zend_dump.c
index b0607c6..155850e 100644
--- a/ext/opcache/Optimizer/zend_dump.c
+++ b/ext/opcache/Optimizer/zend_dump.c
@@ -393,9 +393,7 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *
fprintf(stderr, "%*c", 8-len, ' ');
if (!ssa || !ssa->ops || ssa->ops[opline - op_array->opcodes].result_use < 0) {
- if (opline->result_type == IS_CV ||
- opline->result_type == IS_VAR ||
- opline->result_type == IS_TMP_VAR) {
+ if (opline->result_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
if (ssa && ssa->ops) {
int ssa_var_num = ssa->ops[opline - op_array->opcodes].result_def;
ZEND_ASSERT(ssa_var_num >= 0);
@@ -567,9 +565,7 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *
if (opline->op1_type == IS_CONST) {
zend_dump_const(CRT_CONSTANT_EX(op_array, opline->op1, (dump_flags &
ZEND_DUMP_RT_CONSTANTS)));
- } else if (opline->op1_type == IS_CV ||
- opline->op1_type == IS_VAR ||
- opline->op1_type == IS_TMP_VAR) {
+ } else if (opline->op1_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
if (ssa && ssa->ops) {
int ssa_var_num = ssa->ops[opline - op_array->opcodes].op1_use;
if (ssa_var_num >= 0) {
@@ -605,9 +601,7 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *
if (opline->op2_type == IS_CONST) {
zend_dump_const(CRT_CONSTANT_EX(op_array, opline->op2, (dump_flags &
ZEND_DUMP_RT_CONSTANTS)));
- } else if (opline->op2_type == IS_CV ||
- opline->op2_type == IS_VAR ||
- opline->op2_type == IS_TMP_VAR) {
+ } else if (opline->op2_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
if (ssa && ssa->ops) {
int ssa_var_num = ssa->ops[opline - op_array->opcodes].op2_use;
if (ssa_var_num >= 0) {
@@ -653,9 +647,7 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *
if (opline->result_type == IS_CONST) {
zend_dump_const(CRT_CONSTANT_EX(op_array, opline->result, (dump_flags &
ZEND_DUMP_RT_CONSTANTS)));
} else if (ssa && ssa->ops && ssa->ops[opline -
op_array->opcodes].result_use >= 0) {
- if (opline->result_type == IS_CV ||
- opline->result_type == IS_VAR ||
- opline->result_type == IS_TMP_VAR) {
+ if (opline->result_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
if (ssa && ssa->ops) {
int ssa_var_num = ssa->ops[opline - op_array->opcodes].result_use;
if (ssa_var_num >= 0) {
diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c
index 08203ec..0da7939 100644
--- a/ext/opcache/Optimizer/zend_ssa.c
+++ b/ext/opcache/Optimizer/zend_ssa.c
@@ -488,16 +488,14 @@ static int zend_ssa_rename(const zend_op_array *op_array, uint32_t
build_flags,
if (next->op1_type == IS_CV) {
ssa_ops[k + 1].op1_use = var[EX_VAR_TO_NUM(next->op1.var)];
//USE_SSA_VAR(next->op1.var);
- } else if (next->op1_type == IS_VAR ||
- next->op1_type == IS_TMP_VAR) {
+ } else if (next->op1_type & (IS_VAR|IS_TMP_VAR)) {
ssa_ops[k + 1].op1_use = var[EX_VAR_TO_NUM(next->op1.var)];
//USE_SSA_VAR(op_array->last_var + next->op1.var);
}
if (next->op2_type == IS_CV) {
ssa_ops[k + 1].op2_use = var[EX_VAR_TO_NUM(next->op2.var)];
//USE_SSA_VAR(next->op2.var);
- } else if (next->op2_type == IS_VAR ||
- next->op2_type == IS_TMP_VAR) {
+ } else if (next->op2_type & (IS_VAR|IS_TMP_VAR)) {
ssa_ops[k + 1].op2_use = var[EX_VAR_TO_NUM(next->op2.var)];
//USE_SSA_VAR(op_array->last_var + next->op2.var);
}
@@ -674,8 +672,7 @@ static int zend_ssa_rename(const zend_op_array *op_array, uint32_t build_flags,
var[EX_VAR_TO_NUM(opline->result.var)] = ssa_vars_count;
ssa_vars_count++;
//NEW_SSA_VAR(opline->result.var)
- } else if (opline->result_type == IS_VAR ||
- opline->result_type == IS_TMP_VAR) {
+ } else if (opline->result_type & (IS_VAR|IS_TMP_VAR)) {
ssa_ops[k].result_def = ssa_vars_count;
var[EX_VAR_TO_NUM(opline->result.var)] = ssa_vars_count;
ssa_vars_count++;