1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 19:23:22 +02:00

Optimizer: Use true / false instead of 1 / 0 when assigning to bool

Changes done with Coccinelle:

    @@
    bool b;
    @@

    - b = 0
    + b = false

    @@
    bool b;
    @@

    - b = 1
    + b = true
This commit is contained in:
Tim Düsterhus
2025-09-23 22:54:43 +02:00
committed by Tim Düsterhus
parent 4934355b6d
commit d8db34138e
12 changed files with 95 additions and 95 deletions
+4 -4
View File
@@ -949,14 +949,14 @@ optimize_const_unary_op:
src = VAR_SOURCE(opline->op1);
if (src && src->opcode == ZEND_QM_ASSIGN) {
zend_op *op = src + 1;
bool optimize = 1;
bool optimize = true;
while (op < opline) {
if ((op->op1_type == opline->op1_type
&& op->op1.var == opline->op1.var)
|| (op->op2_type == opline->op1_type
&& op->op2.var == opline->op1.var)) {
optimize = 0;
optimize = false;
break;
}
op++;
@@ -1566,14 +1566,14 @@ static void zend_t_usage(zend_cfg *cfg, zend_op_array *op_array, zend_bitset use
}
if (ctx->debug_level & ZEND_DUMP_BLOCK_PASS_VARS) {
bool printed = 0;
bool printed = false;
uint32_t i;
for (i = op_array->last_var; i< op_array->T; i++) {
if (zend_bitset_in(used_ext, i)) {
if (!printed) {
fprintf(stderr, "NON-LOCAL-VARS: %d", i);
printed = 1;
printed = true;
} else {
fprintf(stderr, ", %d", i);
}
+7 -7
View File
@@ -414,19 +414,19 @@ int zend_dfa_optimize_calls(zend_op_array *op_array, zend_ssa *ssa)
&& call_info->callee_func
&& zend_string_equals_literal_ci(call_info->callee_func->common.function_name, "in_array")) {
bool strict = 0;
bool strict = false;
bool has_opdata = op->opcode == ZEND_FRAMELESS_ICALL_3;
ZEND_ASSERT(!call_info->is_prototype);
if (has_opdata) {
if (zend_is_true(CT_CONSTANT_EX(op_array, (op + 1)->op1.constant))) {
strict = 1;
strict = true;
}
}
if (op->op2_type == IS_CONST
&& Z_TYPE_P(CT_CONSTANT_EX(op_array, op->op2.constant)) == IS_ARRAY) {
bool ok = 1;
bool ok = true;
HashTable *src = Z_ARRVAL_P(CT_CONSTANT_EX(op_array, op->op2.constant));
HashTable *dst;
@@ -443,7 +443,7 @@ int zend_dfa_optimize_calls(zend_op_array *op_array, zend_ssa *ssa)
zend_hash_index_add(dst, Z_LVAL_P(val), &tmp);
} else {
zend_array_destroy(dst);
ok = 0;
ok = false;
break;
}
} ZEND_HASH_FOREACH_END();
@@ -451,7 +451,7 @@ int zend_dfa_optimize_calls(zend_op_array *op_array, zend_ssa *ssa)
ZEND_HASH_FOREACH_VAL(src, val) {
if (Z_TYPE_P(val) != IS_STRING || ZEND_HANDLE_NUMERIC(Z_STR_P(val), idx)) {
zend_array_destroy(dst);
ok = 0;
ok = false;
break;
}
zend_hash_add(dst, Z_STR_P(val), &tmp);
@@ -711,12 +711,12 @@ static int zend_dfa_optimize_jmps(zend_op_array *op_array, zend_ssa *ssa)
uint32_t op_num;
zend_op *opline;
zend_ssa_op *ssa_op;
bool can_follow = 1;
bool can_follow = true;
while (next_block_num < ssa->cfg.blocks_count
&& !(ssa->cfg.blocks[next_block_num].flags & ZEND_BB_REACHABLE)) {
if (ssa->cfg.blocks[next_block_num].flags & ZEND_BB_UNREACHABLE_FREE) {
can_follow = 0;
can_follow = false;
}
next_block_num++;
}
+6 -6
View File
@@ -393,12 +393,12 @@ zend_result zend_ssa_escape_analysis(const zend_script *script, zend_op_array *o
return SUCCESS;
}
has_allocations = 0;
has_allocations = false;
for (i = op_array->last_var; i < ssa_vars_count; i++) {
if (ssa_vars[i].definition >= 0
&& (ssa->var_info[i].type & (MAY_BE_ARRAY|MAY_BE_OBJECT))
&& is_allocation_def(op_array, ssa, ssa_vars[i].definition, i, script)) {
has_allocations = 1;
has_allocations = true;
break;
}
}
@@ -470,7 +470,7 @@ zend_result zend_ssa_escape_analysis(const zend_script *script, zend_op_array *o
bool changed;
do {
changed = 0;
changed = false;
for (i = 0; i < ssa_vars_count; i++) {
if (ssa_vars[i].use_chain >= 0) {
root = ees[i];
@@ -506,13 +506,13 @@ zend_result zend_ssa_escape_analysis(const zend_script *script, zend_op_array *o
if (ssa_vars[root].escape_state == ESCAPE_STATE_GLOBAL_ESCAPE) {
num_non_escaped--;
if (num_non_escaped == 0) {
changed = 0;
changed = false;
} else {
changed = 1;
changed = true;
}
break;
} else {
changed = 1;
changed = true;
}
}
} FOREACH_USE_END();
+9 -9
View File
@@ -237,7 +237,7 @@ void zend_optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx)
}
call_stack[call].func = NULL;
call_stack[call].opline = NULL;
call_stack[call].try_inline = 0;
call_stack[call].try_inline = false;
call_stack[call].func_arg_num = (uint32_t)-1;
break;
case ZEND_FETCH_FUNC_ARG:
@@ -265,7 +265,7 @@ void zend_optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx)
&& opline->op2_type == IS_UNUSED) {
/* FETCH_DIM_FUNC_ARG supports UNUSED op2, while FETCH_DIM_R does not.
* Performing the replacement would create an invalid opcode. */
call_stack[call - 1].try_inline = 0;
call_stack[call - 1].try_inline = false;
break;
}
@@ -279,7 +279,7 @@ void zend_optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx)
break;
case ZEND_SEND_VAL_EX:
if (opline->op2_type == IS_CONST) {
call_stack[call - 1].try_inline = 0;
call_stack[call - 1].try_inline = false;
break;
}
@@ -291,7 +291,7 @@ void zend_optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx)
break;
case ZEND_CHECK_FUNC_ARG:
if (opline->op2_type == IS_CONST) {
call_stack[call - 1].try_inline = 0;
call_stack[call - 1].try_inline = false;
call_stack[call - 1].func_arg_num = (uint32_t)-1;
break;
}
@@ -305,7 +305,7 @@ void zend_optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx)
/* Don't transform SEND_FUNC_ARG if any FETCH opcodes weren't transformed. */
if (call_stack[call - 1].last_check_func_arg_opline == NULL) {
if (opline->op2_type == IS_CONST) {
call_stack[call - 1].try_inline = 0;
call_stack[call - 1].try_inline = false;
}
break;
}
@@ -314,7 +314,7 @@ void zend_optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx)
ZEND_FALLTHROUGH;
case ZEND_SEND_VAR_EX:
if (opline->op2_type == IS_CONST) {
call_stack[call - 1].try_inline = 0;
call_stack[call - 1].try_inline = false;
break;
}
@@ -329,7 +329,7 @@ void zend_optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx)
break;
case ZEND_SEND_VAR_NO_REF_EX:
if (opline->op2_type == IS_CONST) {
call_stack[call - 1].try_inline = 0;
call_stack[call - 1].try_inline = false;
break;
}
@@ -347,14 +347,14 @@ void zend_optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx)
case ZEND_SEND_VAR:
case ZEND_SEND_REF:
if (opline->op2_type == IS_CONST) {
call_stack[call - 1].try_inline = 0;
call_stack[call - 1].try_inline = false;
break;
}
break;
case ZEND_SEND_UNPACK:
case ZEND_SEND_USER:
case ZEND_SEND_ARRAY:
call_stack[call - 1].try_inline = 0;
call_stack[call - 1].try_inline = false;
break;
default:
break;
+7 -7
View File
@@ -193,7 +193,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
if (send1_opline->opcode != ZEND_SEND_VAL ||
send1_opline->op1_type != IS_CONST) {
/* don't collect constants after unknown function call */
collect_constants = 0;
collect_constants = false;
break;
}
if (send1_opline->op2.num == 2) {
@@ -205,7 +205,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
if (send1_opline->opcode != ZEND_SEND_VAL ||
send1_opline->op1_type != IS_CONST) {
/* don't collect constants after unknown function call */
collect_constants = 0;
collect_constants = false;
break;
}
}
@@ -217,7 +217,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
init_opline->op2_type != IS_CONST ||
Z_TYPE(ZEND_OP2_LITERAL(init_opline)) != IS_STRING) {
/* don't collect constants after unknown function call */
collect_constants = 0;
collect_constants = false;
break;
}
@@ -261,7 +261,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
}
/* don't collect constants after any other function call */
collect_constants = 0;
collect_constants = false;
break;
}
case ZEND_STRLEN:
@@ -309,7 +309,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
}
}
}
collect_constants = 0;
collect_constants = false;
break;
case ZEND_JMPZ:
@@ -331,7 +331,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
break;
}
}
collect_constants = 0;
collect_constants = false;
break;
case ZEND_RETURN:
@@ -354,7 +354,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
case ZEND_VERIFY_NEVER_TYPE:
case ZEND_BIND_INIT_STATIC_OR_JMP:
case ZEND_JMP_FRAMELESS:
collect_constants = 0;
collect_constants = false;
break;
}
opline++;
+3 -3
View File
@@ -718,7 +718,7 @@ static inline zend_result ct_eval_in_array(zval *result, uint32_t extended_value
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
res = zend_hash_index_exists(ht, Z_LVAL_P(op1));
} else {
res = 0;
res = false;
}
} else if (Z_TYPE_P(op1) <= IS_FALSE) {
res = zend_hash_exists(ht, ZSTR_EMPTY_ALLOC());
@@ -726,11 +726,11 @@ static inline zend_result ct_eval_in_array(zval *result, uint32_t extended_value
zend_string *key;
zval key_tmp;
res = 0;
res = false;
ZEND_HASH_MAP_FOREACH_STR_KEY(ht, key) {
ZVAL_STR(&key_tmp, key);
if (zend_compare(op1, &key_tmp) == 0) {
res = 1;
res = true;
break;
}
} ZEND_HASH_FOREACH_END();
+7 -7
View File
@@ -146,7 +146,7 @@ ZEND_API void zend_analyze_calls(zend_arena **arena, zend_script *script, uint32
case ZEND_SEND_USER:
if (call_info) {
if (opline->op2_type == IS_CONST) {
call_info->named_args = 1;
call_info->named_args = true;
break;
}
@@ -160,7 +160,7 @@ ZEND_API void zend_analyze_calls(zend_arena **arena, zend_script *script, uint32
case ZEND_SEND_ARRAY:
case ZEND_SEND_UNPACK:
if (call_info) {
call_info->send_unpack = 1;
call_info->send_unpack = true;
}
break;
}
@@ -173,7 +173,7 @@ static bool zend_is_indirectly_recursive(zend_op_array *root, zend_op_array *op_
{
zend_func_info *func_info;
zend_call_info *call_info;
bool ret = 0;
bool ret = false;
if (op_array == root) {
return 1;
@@ -187,8 +187,8 @@ static bool zend_is_indirectly_recursive(zend_op_array *root, zend_op_array *op_
call_info = func_info->caller_info;
while (call_info) {
if (zend_is_indirectly_recursive(root, call_info->caller_op_array, visited)) {
call_info->recursive = 1;
ret = 1;
call_info->recursive = true;
ret = true;
}
call_info = call_info->next_caller;
}
@@ -216,12 +216,12 @@ static void zend_analyze_recursion(zend_call_graph *call_graph)
continue;
}
if (call_info->caller_op_array == op_array) {
call_info->recursive = 1;
call_info->recursive = true;
func_info->flags |= ZEND_FUNC_RECURSIVE | ZEND_FUNC_RECURSIVE_DIRECTLY;
} else {
memset(visited, 0, sizeof(zend_ulong) * set_len);
if (zend_is_indirectly_recursive(op_array, call_info->caller_op_array, visited)) {
call_info->recursive = 1;
call_info->recursive = true;
func_info->flags |= ZEND_FUNC_RECURSIVE | ZEND_FUNC_RECURSIVE_INDIRECTLY;
}
}
+2 -2
View File
@@ -280,7 +280,7 @@ ZEND_API void zend_build_cfg(zend_arena **arena, const zend_op_array *op_array,
int blocks_count = 0;
zend_basic_block *blocks;
zval *zv;
bool extra_entry_block = 0;
bool extra_entry_block = false;
cfg->flags = build_flags & (ZEND_CFG_STACKLESS|ZEND_CFG_RECV_ENTRY);
@@ -445,7 +445,7 @@ ZEND_API void zend_build_cfg(zend_arena **arena, const zend_op_array *op_array,
/* If the entry block has predecessors, we may need to split it */
if ((build_flags & ZEND_CFG_NO_ENTRY_PREDECESSORS)
&& op_array->last > 0 && block_map[0] > 1) {
extra_entry_block = 1;
extra_entry_block = true;
}
if (op_array->last_try_catch) {
+41 -41
View File
@@ -30,11 +30,11 @@ void zend_dump_ht(HashTable *ht)
zend_ulong index;
zend_string *key;
zval *val;
bool first = 1;
bool first = true;
ZEND_HASH_FOREACH_KEY_VAL(ht, index, key, val) {
if (first) {
first = 0;
first = false;
} else {
fprintf(stderr, ", ");
}
@@ -188,36 +188,36 @@ static void zend_dump_range(const zend_ssa_range *r)
static void zend_dump_type_info(uint32_t info, zend_class_entry *ce, int is_instanceof, uint32_t dump_flags)
{
bool first = 1;
bool first = true;
fprintf(stderr, " [");
if (info & MAY_BE_GUARD) {
fprintf(stderr, "!");
}
if (info & MAY_BE_UNDEF) {
if (first) first = 0; else fprintf(stderr, ", ");
if (first) first = false; else fprintf(stderr, ", ");
fprintf(stderr, "undef");
}
if (info & MAY_BE_INDIRECT) {
if (first) first = 0; else fprintf(stderr, ", ");
if (first) first = false; else fprintf(stderr, ", ");
fprintf(stderr, "ind");
}
if (info & MAY_BE_REF) {
if (first) first = 0; else fprintf(stderr, ", ");
if (first) first = false; else fprintf(stderr, ", ");
fprintf(stderr, "ref");
}
if (dump_flags & ZEND_DUMP_RC_INFERENCE) {
if (info & MAY_BE_RC1) {
if (first) first = 0; else fprintf(stderr, ", ");
if (first) first = false; else fprintf(stderr, ", ");
fprintf(stderr, "rc1");
}
if (info & MAY_BE_RCN) {
if (first) first = 0; else fprintf(stderr, ", ");
if (first) first = false; else fprintf(stderr, ", ");
fprintf(stderr, "rcn");
}
}
if (info & MAY_BE_CLASS) {
if (first) first = 0; else fprintf(stderr, ", ");
if (first) first = false; else fprintf(stderr, ", ");
fprintf(stderr, "class");
if (ce) {
if (is_instanceof) {
@@ -227,37 +227,37 @@ static void zend_dump_type_info(uint32_t info, zend_class_entry *ce, int is_inst
}
}
} else if ((info & MAY_BE_ANY) == MAY_BE_ANY) {
if (first) first = 0; else fprintf(stderr, ", ");
if (first) first = false; else fprintf(stderr, ", ");
fprintf(stderr, "any");
} else {
if (info & MAY_BE_NULL) {
if (first) first = 0; else fprintf(stderr, ", ");
if (first) first = false; else fprintf(stderr, ", ");
fprintf(stderr, "null");
}
if ((info & MAY_BE_FALSE) && (info & MAY_BE_TRUE)) {
if (first) first = 0; else fprintf(stderr, ", ");
if (first) first = false; else fprintf(stderr, ", ");
fprintf(stderr, "bool");
} else if (info & MAY_BE_FALSE) {
if (first) first = 0; else fprintf(stderr, ", ");
if (first) first = false; else fprintf(stderr, ", ");
fprintf(stderr, "false");
} else if (info & MAY_BE_TRUE) {
if (first) first = 0; else fprintf(stderr, ", ");
if (first) first = false; else fprintf(stderr, ", ");
fprintf(stderr, "true");
}
if (info & MAY_BE_LONG) {
if (first) first = 0; else fprintf(stderr, ", ");
if (first) first = false; else fprintf(stderr, ", ");
fprintf(stderr, "long");
}
if (info & MAY_BE_DOUBLE) {
if (first) first = 0; else fprintf(stderr, ", ");
if (first) first = false; else fprintf(stderr, ", ");
fprintf(stderr, "double");
}
if (info & MAY_BE_STRING) {
if (first) first = 0; else fprintf(stderr, ", ");
if (first) first = false; else fprintf(stderr, ", ");
fprintf(stderr, "string");
}
if (info & MAY_BE_ARRAY) {
if (first) first = 0; else fprintf(stderr, ", ");
if (first) first = false; else fprintf(stderr, ", ");
if (info & MAY_BE_PACKED_GUARD) {
fprintf(stderr, "!");
}
@@ -268,18 +268,18 @@ static void zend_dump_type_info(uint32_t info, zend_class_entry *ce, int is_inst
} else if (MAY_BE_HASH_ONLY(info)) {
fprintf(stderr, "hash ");
} else if ((info & MAY_BE_ARRAY_KEY_ANY) != MAY_BE_ARRAY_KEY_ANY && (info & MAY_BE_ARRAY_KEY_ANY) != 0) {
bool afirst = 1;
bool afirst = true;
fprintf(stderr, "[");
if (info & MAY_BE_ARRAY_EMPTY) {
if (afirst) afirst = 0; else fprintf(stderr, ", ");
if (afirst) afirst = false; else fprintf(stderr, ", ");
fprintf(stderr, "empty");
}
if (MAY_BE_PACKED(info)) {
if (afirst) afirst = 0; else fprintf(stderr, ", ");
if (afirst) afirst = false; else fprintf(stderr, ", ");
fprintf(stderr, "packed");
}
if (MAY_BE_HASH(info)) {
if (afirst) afirst = 0; else fprintf(stderr, ", ");
if (afirst) afirst = false; else fprintf(stderr, ", ");
fprintf(stderr, "hash");
}
fprintf(stderr, "] ");
@@ -288,71 +288,71 @@ static void zend_dump_type_info(uint32_t info, zend_class_entry *ce, int is_inst
if ((info & (MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING)) != 0 &&
((info & MAY_BE_ARRAY_KEY_LONG) == 0 ||
(info & MAY_BE_ARRAY_KEY_STRING) == 0)) {
bool afirst = 1;
bool afirst = true;
fprintf(stderr, " [");
if (info & MAY_BE_ARRAY_KEY_LONG) {
if (afirst) afirst = 0; else fprintf(stderr, ", ");
if (afirst) afirst = false; else fprintf(stderr, ", ");
fprintf(stderr, "long");
}
if (info & MAY_BE_ARRAY_KEY_STRING) {
if (afirst) afirst = 0; else fprintf(stderr, ", ");
if (afirst) afirst = false; else fprintf(stderr, ", ");
fprintf(stderr, "string");
}
fprintf(stderr, "]");
}
if (info & (MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF)) {
bool afirst = 1;
bool afirst = true;
fprintf(stderr, " of [");
if ((info & MAY_BE_ARRAY_OF_ANY) == MAY_BE_ARRAY_OF_ANY) {
if (afirst) afirst = 0; else fprintf(stderr, ", ");
if (afirst) afirst = false; else fprintf(stderr, ", ");
fprintf(stderr, "any");
} else {
if (info & MAY_BE_ARRAY_OF_NULL) {
if (afirst) afirst = 0; else fprintf(stderr, ", ");
if (afirst) afirst = false; else fprintf(stderr, ", ");
fprintf(stderr, "null");
}
if (info & MAY_BE_ARRAY_OF_FALSE) {
if (afirst) afirst = 0; else fprintf(stderr, ", ");
if (afirst) afirst = false; else fprintf(stderr, ", ");
fprintf(stderr, "false");
}
if (info & MAY_BE_ARRAY_OF_TRUE) {
if (afirst) afirst = 0; else fprintf(stderr, ", ");
if (afirst) afirst = false; else fprintf(stderr, ", ");
fprintf(stderr, "true");
}
if (info & MAY_BE_ARRAY_OF_LONG) {
if (afirst) afirst = 0; else fprintf(stderr, ", ");
if (afirst) afirst = false; else fprintf(stderr, ", ");
fprintf(stderr, "long");
}
if (info & MAY_BE_ARRAY_OF_DOUBLE) {
if (afirst) afirst = 0; else fprintf(stderr, ", ");
if (afirst) afirst = false; else fprintf(stderr, ", ");
fprintf(stderr, "double");
}
if (info & MAY_BE_ARRAY_OF_STRING) {
if (afirst) afirst = 0; else fprintf(stderr, ", ");
if (afirst) afirst = false; else fprintf(stderr, ", ");
fprintf(stderr, "string");
}
if (info & MAY_BE_ARRAY_OF_ARRAY) {
if (afirst) afirst = 0; else fprintf(stderr, ", ");
if (afirst) afirst = false; else fprintf(stderr, ", ");
fprintf(stderr, "array");
}
if (info & MAY_BE_ARRAY_OF_OBJECT) {
if (afirst) afirst = 0; else fprintf(stderr, ", ");
if (afirst) afirst = false; else fprintf(stderr, ", ");
fprintf(stderr, "object");
}
if (info & MAY_BE_ARRAY_OF_RESOURCE) {
if (afirst) afirst = 0; else fprintf(stderr, ", ");
if (afirst) afirst = false; else fprintf(stderr, ", ");
fprintf(stderr, "resource");
}
}
if (info & MAY_BE_ARRAY_OF_REF) {
if (afirst) afirst = 0; else fprintf(stderr, ", ");
if (afirst) afirst = false; else fprintf(stderr, ", ");
fprintf(stderr, "ref");
}
fprintf(stderr, "]");
}
}
if (info & MAY_BE_OBJECT) {
if (first) first = 0; else fprintf(stderr, ", ");
if (first) first = false; else fprintf(stderr, ", ");
fprintf(stderr, "object");
if (ce) {
if (is_instanceof) {
@@ -363,7 +363,7 @@ static void zend_dump_type_info(uint32_t info, zend_class_entry *ce, int is_inst
}
}
if (info & MAY_BE_RESOURCE) {
if (first) first = 0; else fprintf(stderr, ", ");
if (first) first = false; else fprintf(stderr, ", ");
fprintf(stderr, "resource");
}
}
@@ -1216,14 +1216,14 @@ void zend_dump_ssa_variables(const zend_op_array *op_array, const zend_ssa *ssa,
static void zend_dump_var_set(const zend_op_array *op_array, const char *name, zend_bitset set)
{
bool first = 1;
bool first = true;
uint32_t i;
fprintf(stderr, " ; %s = {", name);
for (i = 0; i < op_array->last_var + op_array->T; i++) {
if (zend_bitset_in(set, i)) {
if (first) {
first = 0;
first = false;
} else {
fprintf(stderr, ", ");
}
+1 -1
View File
@@ -136,7 +136,7 @@ ZEND_API uint32_t zend_get_func_info(
uint32_t ret = 0;
const zend_function *callee_func = call_info->callee_func;
*ce = NULL;
*ce_is_instanceof = 0;
*ce_is_instanceof = false;
if (callee_func->type == ZEND_INTERNAL_FUNCTION) {
uint32_t internal_ret = zend_get_internal_func_info(callee_func, call_info, ssa);
+1 -1
View File
@@ -901,7 +901,7 @@ const zend_class_constant *zend_fetch_class_const_info(
zend_function *zend_optimizer_get_called_func(
zend_script *script, zend_op_array *op_array, zend_op *opline, bool *is_prototype)
{
*is_prototype = 0;
*is_prototype = false;
switch (opline->opcode) {
case ZEND_INIT_FCALL:
{
+7 -7
View File
@@ -1671,15 +1671,15 @@ void zend_ssa_rename_var_uses(zend_ssa *ssa, int old, int new, bool update_types
/* If the op already uses the new var, don't add the op to the use
* list again. Instead move the use_chain to the correct operand. */
bool add_to_use_chain = 1;
bool add_to_use_chain = true;
if (ssa_op->result_use == new) {
add_to_use_chain = 0;
add_to_use_chain = false;
} else if (ssa_op->op1_use == new) {
if (ssa_op->result_use == old) {
ssa_op->res_use_chain = ssa_op->op1_use_chain;
ssa_op->op1_use_chain = -1;
}
add_to_use_chain = 0;
add_to_use_chain = false;
} else if (ssa_op->op2_use == new) {
if (ssa_op->result_use == old) {
ssa_op->res_use_chain = ssa_op->op2_use_chain;
@@ -1688,7 +1688,7 @@ void zend_ssa_rename_var_uses(zend_ssa *ssa, int old, int new, bool update_types
ssa_op->op1_use_chain = ssa_op->op2_use_chain;
ssa_op->op2_use_chain = -1;
}
add_to_use_chain = 0;
add_to_use_chain = false;
}
/* Perform the actual renaming */
@@ -1723,7 +1723,7 @@ void zend_ssa_rename_var_uses(zend_ssa *ssa, int old, int new, bool update_types
/* Update phi use chains */
FOREACH_PHI_USE(old_var, phi) {
int j;
bool after_first_new_source = 0;
bool after_first_new_source = false;
/* If the phi already uses the new var, find its use chain, as we may
* need to move it to a different source operand. */
@@ -1737,7 +1737,7 @@ void zend_ssa_rename_var_uses(zend_ssa *ssa, int old, int new, bool update_types
for (j = 0; j < ssa->cfg.blocks[phi->block].predecessors_count; j++) {
if (phi->sources[j] == new) {
after_first_new_source = 1;
after_first_new_source = true;
} else if (phi->sources[j] == old) {
phi->sources[j] = new;
@@ -1751,7 +1751,7 @@ void zend_ssa_rename_var_uses(zend_ssa *ssa, int old, int new, bool update_types
phi->use_chains[j] = new_var->phi_use_chain;
new_var->phi_use_chain = phi;
}
after_first_new_source = 1;
after_first_new_source = true;
} else {
phi->use_chains[j] = NULL;
}