From e2a4ccc9c20b2d221e46ae996efd806f200ed318 Mon Sep 17 00:00:00 2001 From: arshidkv12 Date: Mon, 5 Oct 2026 12:48:39 +0530 Subject: [PATCH 1/3] Use true and false for bool return values --- Zend/Optimizer/zend_inference.c | 82 +++++++++--------- ext/opcache/jit/ir/ir.c | 10 +-- ext/opcache/jit/ir/ir_cfg.c | 8 +- ext/opcache/jit/ir/ir_check.c | 8 +- ext/opcache/jit/ir/ir_emit.c | 30 +++---- ext/opcache/jit/ir/ir_gdb.c | 4 +- ext/opcache/jit/ir/ir_sccp.c | 126 ++++++++++++++-------------- ext/opcache/jit/zend_jit.c | 68 +++++++-------- sapi/apache2handler/apache_config.c | 6 +- 9 files changed, 171 insertions(+), 171 deletions(-) diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index c2f6098a8122..9ffc3157130c 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -737,7 +737,7 @@ static inline bool zend_abs_range( zend_long min, zend_long max, zend_long *abs_min, zend_long *abs_max) { if (min == ZEND_LONG_MIN) { /* Cannot take absolute value of LONG_MIN */ - return 0; + return false; } if (min >= 0) { @@ -752,7 +752,7 @@ static inline bool zend_abs_range( *abs_max = MAX(max, -min); } - return 1; + return true; } static inline zend_long safe_shift_left(zend_long n, zend_long s) { @@ -809,7 +809,7 @@ static bool zend_inference_calc_binary_op_range( } else { tmp->max = op1_max + op2_max; } - return 1; + return true; } break; case ZEND_SUB: @@ -834,7 +834,7 @@ static bool zend_inference_calc_binary_op_range( } else { tmp->max = op1_max - op2_min; } - return 1; + return true; } break; case ZEND_MUL: @@ -867,7 +867,7 @@ static bool zend_inference_calc_binary_op_range( tmp->min = MIN(MIN(t1, t2), MIN(t3, t4)); tmp->max = MAX(MAX(t1, t2), MAX(t3, t4)); } - return 1; + return true; } break; case ZEND_DIV: @@ -899,7 +899,7 @@ static bool zend_inference_calc_binary_op_range( tmp->min = MIN(MIN(MIN(t1, t2), MIN(t3, t4)), MIN(MIN(t1_, t2_), MIN(t3_, t4_))); tmp->max = MAX(MAX(MAX(t1, t2), MAX(t3, t4)), MAX(MAX(t1_, t2_), MAX(t3_, t4_))); } - return 1; + return true; } break; case ZEND_MOD: @@ -941,7 +941,7 @@ static bool zend_inference_calc_binary_op_range( tmp->max = MIN(op1_max, op2_abs_max - 1); } } - return 1; + return true; } break; case ZEND_SL: @@ -979,7 +979,7 @@ static bool zend_inference_calc_binary_op_range( tmp->max = MAX(MAX(t1, t2), MAX(t3, t4)); } } - return 1; + return true; } break; case ZEND_SR: @@ -1019,7 +1019,7 @@ static bool zend_inference_calc_binary_op_range( tmp->min = MIN(MIN(t1, t2), MIN(t3, t4)); tmp->max = MAX(MAX(t1, t2), MAX(t3, t4)); } - return 1; + return true; } break; case ZEND_BW_OR: @@ -1037,7 +1037,7 @@ static bool zend_inference_calc_binary_op_range( op2_max = OP2_MAX_RANGE(); zend_ssa_range_or(op1_min, op1_max, op2_min, op2_max, tmp); } - return 1; + return true; } break; case ZEND_BW_AND: @@ -1055,7 +1055,7 @@ static bool zend_inference_calc_binary_op_range( op2_max = OP2_MAX_RANGE(); zend_ssa_range_and(op1_min, op1_max, op2_min, op2_max, tmp); } - return 1; + return true; } break; case ZEND_BW_XOR: @@ -1063,7 +1063,7 @@ static bool zend_inference_calc_binary_op_range( break; default: ZEND_UNREACHABLE(); } - return 0; + return false; } static bool zend_inference_calc_range(const zend_op_array *op_array, const zend_ssa *ssa, int var, int widening, bool narrowing, zend_ssa_range *tmp) @@ -1237,7 +1237,7 @@ static bool zend_inference_calc_range(const zend_op_array *op_array, const zend_ } return (tmp->min <= tmp->max); } else if (ssa->vars[var].definition < 0) { - return 0; + return false; } line = ssa->vars[var].definition; opline = op_array->opcodes + line; @@ -1635,11 +1635,11 @@ static bool zend_inference_widening_meet(zend_ssa_var_info *var_info, zend_ssa_r var_info->range.max == r->max && var_info->range.underflow == r->underflow && var_info->range.overflow == r->overflow) { - return 0; + return false; } } var_info->range = *r; - return 1; + return true; } static bool zend_ssa_range_widening(const zend_op_array *op_array, const zend_ssa *ssa, int var, int scc) @@ -1649,10 +1649,10 @@ static bool zend_ssa_range_widening(const zend_op_array *op_array, const zend_ss if (zend_inference_calc_range(op_array, ssa, var, 1, 0, &tmp)) { if (zend_inference_widening_meet(&ssa->var_info[var], &tmp)) { LOG_SSA_RANGE(" change range (widening SCC %2d) %2d [%s%ld..%ld%s]\n", scc, var, (tmp.underflow?"-- ":""), tmp.min, tmp.max, (tmp.overflow?" ++":"")); - return 1; + return true; } } - return 0; + return false; } static bool zend_inference_narrowing_meet(zend_ssa_var_info *var_info, zend_ssa_range *r) @@ -1680,11 +1680,11 @@ static bool zend_inference_narrowing_meet(zend_ssa_var_info *var_info, zend_ssa_ var_info->range.max == r->max && var_info->range.underflow == r->underflow && var_info->range.overflow == r->overflow) { - return 0; + return false; } } var_info->range = *r; - return 1; + return true; } static bool zend_ssa_range_narrowing(const zend_op_array *op_array, const zend_ssa *ssa, int var, int scc) @@ -1694,10 +1694,10 @@ static bool zend_ssa_range_narrowing(const zend_op_array *op_array, const zend_s if (zend_inference_calc_range(op_array, ssa, var, 0, 1, &tmp)) { if (zend_inference_narrowing_meet(&ssa->var_info[var], &tmp)) { LOG_SSA_RANGE(" change range (narrowing SCC %2d) %2d [%s%ld..%ld%s]\n", scc, var, (tmp.underflow?"-- ":""), tmp.min, tmp.max, (tmp.overflow?" ++":"")); - return 1; + return true; } } - return 0; + return false; } #ifdef NEG_RANGE @@ -1714,12 +1714,12 @@ static bool zend_ssa_range_narrowing(const zend_op_array *op_array, const zend_s static bool zend_check_inner_cycles(const zend_op_array *op_array, zend_ssa *ssa, zend_bitset worklist, zend_bitset visited, int var) { if (zend_bitset_in(worklist, var)) { - return 1; + return true; } zend_bitset_incl(worklist, var); FOR_EACH_VAR_USAGE(var, CHECK_INNER_CYCLE); zend_bitset_incl(visited, var); - return 0; + return false; } #endif @@ -2514,11 +2514,11 @@ static bool result_may_be_separated(const zend_ssa *ssa, const zend_ssa_op *ssa_ if (use_op == ssa_op + 1) { if ((use_op->op1_use == tmp_var && use_op->op1_use_chain < 0) || (use_op->op2_use == tmp_var && use_op->op2_use_chain < 0)) { - return 0; + return false; } } } - return 1; + return true; } static zend_always_inline zend_result _zend_update_type_info( @@ -4174,11 +4174,11 @@ static zend_class_entry *join_class_entries( static bool safe_instanceof(const zend_class_entry *ce1, const zend_class_entry *ce2) { if (ce1 == ce2) { - return 1; + return true; } if (!(ce1->ce_flags & ZEND_ACC_LINKED)) { /* This case could be generalized, similarly to unlinked_instanceof */ - return 0; + return false; } return instanceof_function(ce1, ce2); } @@ -4315,7 +4315,7 @@ static bool can_convert_to_double( uint32_t type; if (zend_bitset_in(visited, var_num)) { - return 1; + return true; } zend_bitset_incl(visited, var_num); @@ -4328,7 +4328,7 @@ static bool can_convert_to_double( } if (!is_narrowable_instr(opline)) { - return 0; + return false; } /* Instruction always returns double, the conversion is certainly fine */ @@ -4340,12 +4340,12 @@ static bool can_convert_to_double( /* UNDEF signals that the previous result is an effective double cast, this is only allowed * if this instruction would have done the cast anyway (previous check). */ if (Z_ISUNDEF_P(value)) { - return 0; + return false; } /* Check that narrowing can actually be useful */ if ((type & MAY_BE_ANY) & ~(MAY_BE_LONG|MAY_BE_DOUBLE)) { - return 0; + return false; } { @@ -4387,7 +4387,7 @@ static bool can_convert_to_double( } else if (is_effective_op1_double_cast(opline, &orig_op2)) { ZVAL_UNDEF(&orig_result); } else { - return 0; + return false; } } else if (Z_ISUNDEF(orig_op2)) { if (opline->opcode == ZEND_MUL && Z_LVAL(orig_op1) == 0) { @@ -4395,7 +4395,7 @@ static bool can_convert_to_double( } else if (is_effective_op2_double_cast(opline, &orig_op1)) { ZVAL_UNDEF(&orig_result); } else { - return 0; + return false; } } else { uint8_t opcode = opline->opcode; @@ -4406,19 +4406,19 @@ static bool can_convert_to_double( /* Avoid division by zero */ if (opcode == ZEND_DIV && zval_get_double(&orig_op2) == 0.0) { - return 0; + return false; } get_binary_op(opcode)(&orig_result, &orig_op1, &orig_op2); get_binary_op(opcode)(&dval_result, &dval_op1, &dval_op2); ZEND_ASSERT(Z_TYPE(dval_result) == IS_DOUBLE); if (zval_get_double(&orig_result) != Z_DVAL(dval_result)) { - return 0; + return false; } } if (!can_convert_to_double(op_array, ssa, ssa_op->result_def, &orig_result, visited)) { - return 0; + return false; } } } @@ -4427,15 +4427,15 @@ static bool can_convert_to_double( /* Check that narrowing can actually be useful */ type = ssa->var_info[phi->ssa_var].type; if ((type & MAY_BE_ANY) & ~(MAY_BE_LONG|MAY_BE_DOUBLE)) { - return 0; + return false; } if (!can_convert_to_double(op_array, ssa, phi->ssa_var, value, visited)) { - return 0; + return false; } } - return 1; + return true; } static zend_result zend_type_narrowing(const zend_op_array *op_array, const zend_script *script, zend_ssa *ssa, zend_long optimization_level) @@ -4504,11 +4504,11 @@ static bool is_recursive_tail_call(const zend_op_array *op_array, const zend_op if (op->opcode == ZEND_DO_UCALL) { const zend_call_info *call_info = info->call_map[op - op_array->opcodes]; if (call_info && op_array == &call_info->callee_func->op_array) { - return 1; + return true; } } } - return 0; + return false; } uint32_t zend_get_return_info_from_signature_only( diff --git a/ext/opcache/jit/ir/ir.c b/ext/opcache/jit/ir/ir.c index 120722b2dcad..c8f602d6d781 100644 --- a/ext/opcache/jit/ir/ir.c +++ b/ext/opcache/jit/ir/ir.c @@ -1650,7 +1650,7 @@ bool ir_use_list_add(ir_ctx *ctx, ir_ref to, ir_ref ref) if (n < ctx->use_edges_count && ctx->use_edges[n] == IR_UNUSED) { ctx->use_edges[n] = ref; use_list->count++; - return 0; + return false; } else { size_t old_size = IR_ALIGNED_SIZE(ctx->use_edges_count * sizeof(ir_ref), 4096); size_t new_size = IR_ALIGNED_SIZE((ctx->use_edges_count + use_list->count + 1) * sizeof(ir_ref), 4096); @@ -1662,13 +1662,13 @@ bool ir_use_list_add(ir_ctx *ctx, ir_ref to, ir_ref ref) ctx->use_edges[n] = ref; use_list->count++; ctx->use_edges_count++; - return 1; + return true; } } else if (n == ctx->use_edges_count) { ctx->use_edges[n] = ref; use_list->count++; ctx->use_edges_count++; - return 0; + return false; } if (use_list->count) { memcpy(ctx->use_edges + ctx->use_edges_count, ctx->use_edges + use_list->refs, use_list->count * sizeof(ir_ref)); @@ -1677,7 +1677,7 @@ bool ir_use_list_add(ir_ctx *ctx, ir_ref to, ir_ref ref) ctx->use_edges[use_list->refs + use_list->count] = ref; use_list->count++; ctx->use_edges_count += use_list->count; - return 1; + return true; } } @@ -1908,7 +1908,7 @@ bool ir_hashtab_add(ir_hashtab *tab, uint32_t key, ir_ref val) key |= tab->mask; p->next = ((uint32_t*)data)[(int32_t)key]; ((uint32_t*)data)[(int32_t)key] = pos; - return 1; + return true; } static int ir_hashtab_key_cmp(const void *b1, const void *b2) diff --git a/ext/opcache/jit/ir/ir_cfg.c b/ext/opcache/jit/ir/ir_cfg.c index 4e4db166d37e..7512f8b0a2eb 100644 --- a/ext/opcache/jit/ir/ir_cfg.c +++ b/ext/opcache/jit/ir/ir_cfg.c @@ -1540,7 +1540,7 @@ static bool ir_is_merged_loop_back_edge(ir_ctx *ctx, uint32_t hdr, uint32_t b) } return b == hdr; } - return 0; + return false; } #endif @@ -1552,13 +1552,13 @@ static bool ir_should_align_loop(ir_ctx *ctx, ir_chain *chains, uint32_t b, ir_b for (; n > 0; p++, n--) { uint32_t pred = *p; if (chains[pred].head) { - if (ir_chain_head(chains, pred) == b) return 1; + if (ir_chain_head(chains, pred) == b) return true; } else { - if (ir_should_align_loop(ctx, chains, b, &ctx->cfg_blocks[pred])) return 1; + if (ir_should_align_loop(ctx, chains, b, &ctx->cfg_blocks[pred])) return true; } } - return 0; + return false; } static int ir_schedule_blocks_bottom_up(ir_ctx *ctx) diff --git a/ext/opcache/jit/ir/ir_check.c b/ext/opcache/jit/ir/ir_check.c index fd7ba4478abe..d5f5cc93d876 100644 --- a/ext/opcache/jit/ir/ir_check.c +++ b/ext/opcache/jit/ir/ir_check.c @@ -78,10 +78,10 @@ static bool ir_check_use_list(ir_check_ctx *check_ctx, const ir_ctx *ctx, ir_ref } for (p = &ctx->use_edges[use_list->refs]; n > 0; p++, n--) { if (*p == to) { - return 1; + return true; } } - return 0; + return false; } static bool ir_check_input_list(ir_check_ctx *check_ctx, const ir_ctx *ctx, ir_ref from, ir_ref to) @@ -115,10 +115,10 @@ static bool ir_check_input_list(ir_check_ctx *check_ctx, const ir_ctx *ctx, ir_r } for (j = 1, p = insn->ops + 1; j <= n; j++, p++) { if (*p == from) { - return 1; + return true; } } - return 0; + return false; } static bool ir_check_domination(const ir_ctx *ctx, ir_ref def, ir_ref use) diff --git a/ext/opcache/jit/ir/ir_emit.c b/ext/opcache/jit/ir/ir_emit.c index 8c01f56c9e30..bfacea04aaa8 100644 --- a/ext/opcache/jit/ir/ir_emit.c +++ b/ext/opcache/jit/ir/ir_emit.c @@ -247,7 +247,7 @@ static bool ir_is_same_mem_var(const ir_ctx *ctx, ir_ref r1, int32_t offset) int32_t o1; if (IR_IS_CONST_REF(r1)) { - return 0; + return false; } IR_ASSERT(ctx->vregs[r1]); @@ -1058,9 +1058,9 @@ static void ir_emit_dessa_moves(ir_ctx *ctx, int b, ir_block *bb) /* TAILCALL optimization */ static bool ir_may_be_local_addr(ir_ctx *ctx, ir_insn *insn) { - if (insn->op == IR_PARAM) return 0; + if (insn->op == IR_PARAM) return false; - return 1; + return true; } static bool ir_try_tailcall(ir_ctx *ctx, ir_ref ref, ir_insn *insn) @@ -1078,7 +1078,7 @@ static bool ir_try_tailcall(ir_ctx *ctx, ir_ref ref, ir_insn *insn) if (rule) { ctx->rules[ref] = rule; - return 0; + return false; } proto_ref = func->proto; } else if (func->op == IR_FUNC_ADDR) { @@ -1088,10 +1088,10 @@ static bool ir_try_tailcall(ir_ctx *ctx, ir_ref ref, ir_insn *insn) proto_ref = ctx->ir_base[insn->op2].op2; } - if (!proto_ref) return 0; + if (!proto_ref) return false; proto = (const ir_proto_t *)ir_get_str(ctx, proto_ref); - if ((proto->flags & IR_CALL_CONV_MASK) != (ctx->flags & IR_CALL_CONV_MASK)) return 0; + if ((proto->flags & IR_CALL_CONV_MASK) != (ctx->flags & IR_CALL_CONV_MASK)) return false; cc = ir_get_call_conv_dsc(proto ? proto->flags : IR_CC_DEFAULT); copy_stack = 0; @@ -1101,7 +1101,7 @@ static bool ir_try_tailcall(ir_ctx *ctx, ir_ref ref, ir_insn *insn) } // TODO: "params_stack_size" must match the "args_stack_size" - if (params_stack_size) return 0; + if (params_stack_size) return false; /* check for passing addresses of local variable */ uint32_t n = insn->inputs_count; @@ -1110,7 +1110,7 @@ static bool ir_try_tailcall(ir_ctx *ctx, ir_ref ref, ir_insn *insn) if (!IR_IS_CONST_REF(input) && ctx->ir_base[input].type == IR_ADDR) { /* Passing addrss of local varible to TAILCALL is disallowd */ if (ir_may_be_local_addr(ctx, &ctx->ir_base[input])) { - return 0; + return false; } } } @@ -1134,7 +1134,7 @@ static bool ir_try_tailcall(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ctx->rules[ref] = IR_TAILCALL | IR_NO_REG; - return 1; + return true; } #if 0 @@ -1558,19 +1558,19 @@ static bool ir_load_may_reuse_var_slot(ir_ctx *ctx, ir_block *bb, ir_ref var, ir if (n) { for (p = ctx->use_edges + use_list->refs; n > 0; p++, n--) { use = *p; - if (use < load || use > bb->end) return 0; + if (use < load || use > bb->end) return false; if (use > last_use) last_use = use; } for (i = load + 1, insn = &ctx->ir_base[i]; i < last_use;) { if ((insn->op == IR_VSTORE || insn->op == IR_VSTORE_v) && insn->op2 == var) { - return 0; + return false; } n = ir_insn_len(insn); i += n; insn += n; } } - return 1; + return true; } static bool ir_store_may_reuse_var_slot(ir_ctx *ctx, ir_block *bb, ir_ref var, ir_ref store, ir_ref val) @@ -1578,18 +1578,18 @@ static bool ir_store_may_reuse_var_slot(ir_ctx *ctx, ir_block *bb, ir_ref var, i ir_ref i, n; ir_insn *insn; - if (val < bb->start && val > store) return 0; + if (val < bb->start && val > store) return false; for (i = val, insn = &ctx->ir_base[i]; i < store;) { if ((insn->op == IR_VLOAD || insn->op == IR_VLOAD_v || insn->op == IR_VSTORE || insn->op == IR_VSTORE_v) && insn->op2 == var) { - return 0; + return false; } n = ir_insn_len(insn); i += n; insn += n; } - return 1; + return true; } static void ir_add_fusion_data(ir_ctx *ctx, ir_ref ref, ir_ref input, ir_reg_alloc_simple_data *x) diff --git a/ext/opcache/jit/ir/ir_gdb.c b/ext/opcache/jit/ir/ir_gdb.c index 5f1bde3fff00..3e2c8769e69a 100644 --- a/ext/opcache/jit/ir/ir_gdb.c +++ b/ext/opcache/jit/ir/ir_gdb.c @@ -534,7 +534,7 @@ static bool ir_gdb_register_code(const void *object, size_t size) entry = malloc(sizeof(ir_gdbjit_code_entry) + size); if (entry == NULL) { - return 0; + return false; } entry->symfile_addr = ((char*)entry) + sizeof(ir_gdbjit_code_entry); @@ -566,7 +566,7 @@ static bool ir_gdb_register_code(const void *object, size_t size) __jit_debug_descriptor.action_flag = IR_GDBJIT_REGISTER; __jit_debug_register_code(); - return 1; + return true; } void ir_gdb_unregister_all(void) diff --git a/ext/opcache/jit/ir/ir_sccp.c b/ext/opcache/jit/ir/ir_sccp.c index 4745c7000d72..1e9cde9a7a96 100644 --- a/ext/opcache/jit/ir/ir_sccp.c +++ b/ext/opcache/jit/ir/ir_sccp.c @@ -378,7 +378,7 @@ static bool ir_sccp_analyze_phi(const ir_ctx *ctx, ir_sccp_val *_values, ir_bitq #endif if (!IR_IS_REACHABLE(insn->op1)) { - return 0; + return false; } n = insn->inputs_count; if (n > 3 && _values[i].op == IR_TOP) { @@ -441,7 +441,7 @@ static bool ir_sccp_analyze_phi(const ir_ctx *ctx, ir_sccp_val *_values, ir_bitq goto next; } - return 0; + return false; next: p++; @@ -515,7 +515,7 @@ static bool ir_sccp_analyze_phi(const ir_ctx *ctx, ir_sccp_val *_values, ir_bitq make_bottom: IR_MAKE_BOTTOM_EX(i); - return 1; + return true; } static bool ir_is_dead_load_ex(const ir_ctx *ctx, ir_ref ref, uint32_t flags, const ir_insn *insn) @@ -525,7 +525,7 @@ static bool ir_is_dead_load_ex(const ir_ctx *ctx, ir_ref ref, uint32_t flags, co } else if (insn->op == IR_ALLOCA || insn->op == IR_BLOCK_BEGIN) { return ctx->use_lists[ref].count == 1; } - return 0; + return false; } static bool ir_is_dead_load(const ir_ctx *ctx, ir_ref ref) @@ -535,12 +535,12 @@ static bool ir_is_dead_load(const ir_ctx *ctx, ir_ref ref) uint32_t flags = ir_op_flags[insn->op]; if ((flags & (IR_OP_FLAG_MEM|IR_OP_FLAG_MEM_MASK)) == (IR_OP_FLAG_MEM|IR_OP_FLAG_MEM_LOAD)) { - return 1; + return true; } else if (insn->op == IR_ALLOCA || insn->op == IR_BLOCK_BEGIN) { - return 1; + return true; } } - return 0; + return false; } static bool ir_is_dead(const ir_ctx *ctx, ir_ref ref) @@ -550,7 +550,7 @@ static bool ir_is_dead(const ir_ctx *ctx, ir_ref ref) } else { return ir_is_dead_load(ctx, ref); } - return 0; + return false; } static bool ir_sccp_is_true(const ir_ctx *ctx, const ir_sccp_val *_values, ir_ref a) @@ -1078,7 +1078,7 @@ static bool ir_sccp_remove_unfeasible_merge_inputs(ir_ctx *ctx, ir_ref ref, ir_i if (life_inputs != &holder) { ir_mem_free(life_inputs); } - return 0; + return false; } for (i = new_merge_inputs + 1; i <= old_merge_inputs; i++) { @@ -1170,7 +1170,7 @@ static bool ir_sccp_remove_unfeasible_merge_inputs(ir_ctx *ctx, ir_ref ref, ir_i ir_mem_free(life_inputs); } - return 1; + return true; } static IR_NEVER_INLINE void ir_sccp_transform(ir_ctx *ctx, const ir_sccp_val *_values, ir_bitqueue *worklist, ir_bitqueue *iter_worklist) @@ -1603,7 +1603,7 @@ static bool ir_may_promote_d2f(const ir_ctx *ctx, ir_ref ref) } else { switch (insn->op) { case IR_FP2FP: - return 1; + return true; // case IR_INT2FP: // return ctx->use_lists[ref].count == 1; case IR_NEG: @@ -1623,7 +1623,7 @@ static bool ir_may_promote_d2f(const ir_ctx *ctx, ir_ref ref) break; } } - return 0; + return false; } static bool ir_may_promote_f2d(const ir_ctx *ctx, ir_ref ref) @@ -1636,7 +1636,7 @@ static bool ir_may_promote_f2d(const ir_ctx *ctx, ir_ref ref) } else { switch (insn->op) { case IR_FP2FP: - return 1; + return true; // case IR_INT2FP: // return ctx->use_lists[ref].count == 1; case IR_NEG: @@ -1656,7 +1656,7 @@ static bool ir_may_promote_f2d(const ir_ctx *ctx, ir_ref ref) break; } } - return 0; + return false; } static ir_ref ir_promote_d2f(ir_ctx *ctx, ir_ref ref, ir_ref use) @@ -1873,7 +1873,7 @@ static bool ir_may_promote_trunc(const ir_ctx *ctx, ir_type type, ir_ref ref) for (p = &ctx->use_edges[use_list->refs], n = use_list->count; n > 0; p++, n--) { if (*p != ref) { if (count) { - return 0; + return false; } count = 1; } @@ -1883,16 +1883,16 @@ static bool ir_may_promote_trunc(const ir_ctx *ctx, ir_type type, ir_ref ref) input = *p; if (input != ref) { if (!ir_may_promote_trunc(ctx, type, input)) { - return 0; + return false; } } } - return 1; + return true; default: break; } } - return 0; + return false; } static ir_ref ir_promote_i2i(ir_ctx *ctx, ir_type type, ir_ref ref, ir_ref use) @@ -2183,17 +2183,17 @@ static bool ir_is_loop_invariant(const ir_ctx *ctx, ir_ref ref, ir_ref loop) static bool ir_is_cheaper_ext(const ir_ctx *ctx, ir_ref ref, ir_ref loop, ir_ref ext_ref, ir_op op) { if (IR_IS_CONST_REF(ref)) { - return 1; + return true; } else { const ir_insn *insn = &ctx->ir_base[ref]; if (insn->op == IR_LOAD) { if (ir_is_loop_invariant(ctx, ref, loop)) { - return 1; + return true; } else { /* ZEXT(LOAD(_, _)) costs the same as LOAD(_, _) */ if (ctx->use_lists[ref].count == 2) { - return 1; + return true; } else if (ctx->use_lists[ref].count == 3) { ir_use_list *use_list = &ctx->use_lists[ref]; ir_ref *p, n, use; @@ -2206,14 +2206,14 @@ static bool ir_is_cheaper_ext(const ir_ctx *ctx, ir_ref ref, ir_ref loop, ir_ref if (use_insn->op != op && (!(ir_op_flags[use_insn->op] & (IR_OP_FLAG_CONTROL|IR_OP_FLAG_MEM)) || use_insn->op1 != ref)) { - return 0; + return false; } } } - return 1; + return true; } } - return 0; + return false; } else { return ir_is_loop_invariant(ctx, ref, loop); } @@ -2242,27 +2242,27 @@ static bool ir_try_promote_induction_var_ext(ir_ctx *ctx, ir_ref ext_ref, ir_ref if (use_insn->op >= IR_EQ && use_insn->op <= IR_UGT) { if (use_insn->op1 == phi_ref) { if (IR_IS_TYPE_SIGNED(type) != IR_IS_TYPE_SIGNED(ctx->ir_base[use_insn->op2].type)) { - return 0; + return false; } if (ir_is_cheaper_ext(ctx, use_insn->op2, ctx->ir_base[phi_ref].op1, ext_ref, op)) { continue; } } else if (use_insn->op2 == phi_ref) { if (IR_IS_TYPE_SIGNED(type) != IR_IS_TYPE_SIGNED(ctx->ir_base[use_insn->op1].type)) { - return 0; + return false; } if (ir_is_cheaper_ext(ctx, use_insn->op1, ctx->ir_base[phi_ref].op1, ext_ref, op)) { continue; } } - return 0; + return false; } else if (use_insn->op == IR_IF) { continue; } else if (!ext_ref_2 && use_insn->op == op && use_insn->type == type) { ext_ref_2 = use; continue; } else { - return 0; + return false; } } } @@ -2281,27 +2281,27 @@ static bool ir_try_promote_induction_var_ext(ir_ctx *ctx, ir_ref ext_ref, ir_ref if (use_insn->op >= IR_EQ && use_insn->op <= IR_UGT) { if (use_insn->op1 == op_ref) { if (IR_IS_TYPE_SIGNED(type) != IR_IS_TYPE_SIGNED(ctx->ir_base[use_insn->op2].type)) { - return 0; + return false; } if (ir_is_cheaper_ext(ctx, use_insn->op2, ctx->ir_base[phi_ref].op1, ext_ref, op)) { continue; } } else if (use_insn->op2 == op_ref) { if (IR_IS_TYPE_SIGNED(type) != IR_IS_TYPE_SIGNED(ctx->ir_base[use_insn->op1].type)) { - return 0; + return false; } if (ir_is_cheaper_ext(ctx, use_insn->op1, ctx->ir_base[phi_ref].op1, ext_ref, op)) { continue; } } - return 0; + return false; } else if (use_insn->op == IR_IF) { continue; } else if (!ext_ref_2 && use_insn->op == op && use_insn->type == type) { ext_ref_2 = use; continue; } else { - return 0; + return false; } } } @@ -2409,7 +2409,7 @@ static bool ir_try_promote_induction_var_ext(ir_ctx *ctx, ir_ref ext_ref, ir_ref ctx->ir_base[phi_ref].op2 = tmp; } - return 1; + return true; } static bool ir_try_promote_ext(ir_ctx *ctx, ir_ref ext_ref, ir_insn *insn) @@ -2467,7 +2467,7 @@ static bool ir_try_promote_ext(ir_ctx *ctx, ir_ref ext_ref, ir_insn *insn) ir_iter_replace_insn(ctx, ext_ref, ref); } - return 0; + return false; } static void ir_get_true_false_refs(const ir_ctx *ctx, ir_ref if_ref, ir_ref *if_true_ref, ir_ref *if_false_ref) @@ -2541,7 +2541,7 @@ static bool ir_try_remove_empty_diamond(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_insn *end2 = &ctx->ir_base[end2_ref]; if (end1->op != IR_END || end2->op != IR_END) { - return 0; + return false; } ir_ref start1_ref = end1->op1, start2_ref = end2->op1; @@ -2549,7 +2549,7 @@ static bool ir_try_remove_empty_diamond(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_insn *start2 = &ctx->ir_base[start2_ref]; if (start1->op1 != start2->op1) { - return 0; + return false; } ir_ref root_ref = start1->op1; @@ -2557,7 +2557,7 @@ static bool ir_try_remove_empty_diamond(ir_ctx *ctx, ir_ref ref, ir_insn *insn) if (root->op != IR_IF && !(root->op == IR_SWITCH && ctx->use_lists[root_ref].count == 2)) { - return 0; + return false; } /* Empty Diamond @@ -2609,7 +2609,7 @@ static bool ir_try_remove_empty_diamond(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_bitqueue_add(ctx->iter_worklist, next->op1); } - return 1; + return true; } else { ir_ref i, count = insn->inputs_count, *ops = insn->ops + 1; ir_ref root_ref = IR_UNUSED; @@ -2621,12 +2621,12 @@ static bool ir_try_remove_empty_diamond(ir_ctx *ctx, ir_ref ref, ir_insn *insn) end_ref = ops[i]; end = &ctx->ir_base[end_ref]; if (end->op != IR_END) { - return 0; + return false; } start_ref = end->op1; start = &ctx->ir_base[start_ref]; if (start->op != IR_CASE_VAL && start->op != IR_CASE_RANGE && start->op != IR_CASE_DEFAULT) { - return 0; + return false; } if (ctx->use_lists[start_ref].count != 1) { ir_remove_unused_vars(ctx, start_ref, end_ref); @@ -2634,10 +2634,10 @@ static bool ir_try_remove_empty_diamond(ir_ctx *ctx, ir_ref ref, ir_insn *insn) if (!root_ref) { root_ref = start->op1; if (ctx->use_lists[root_ref].count != count) { - return 0; + return false; } } else if (start->op1 != root_ref) { - return 0; + return false; } } @@ -2674,7 +2674,7 @@ static bool ir_try_remove_empty_diamond(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_bitqueue_add(ctx->iter_worklist, next->op1); } - return 1; + return true; } } @@ -2695,7 +2695,7 @@ static bool ir_fix_min_max_const(ir_ctx *ctx, ir_insn *cond, ir_ref ref) && ctx->ir_base[cond->op2].val.u64 == ctx->ir_base[ref].val.u64 - 1 && ctx->ir_base[cond->op2].type == ctx->ir_base[ref].type) { cond->op2 = ref; - return 1; + return true; } } else if (cond->op == IR_UGE) { /* (x >= 3 ? 2 : x) => (x > 2 ? 2 : x) => min(x, 2) */ @@ -2705,7 +2705,7 @@ static bool ir_fix_min_max_const(ir_ctx *ctx, ir_insn *cond, ir_ref ref) && ctx->ir_base[cond->op2].val.u64 == ctx->ir_base[ref].val.u64 + 1 && ctx->ir_base[cond->op2].type == ctx->ir_base[ref].type) { cond->op2 = ref; - return 1; + return true; } } else if (cond->op == IR_LE) { /* (x <= 3 ? 4 : x) => (x < 4 ? 4 : x) => max(x, 4) */ @@ -2715,7 +2715,7 @@ static bool ir_fix_min_max_const(ir_ctx *ctx, ir_insn *cond, ir_ref ref) && ctx->ir_base[cond->op2].val.u64 == ctx->ir_base[ref].val.u64 - 1 && ctx->ir_base[cond->op2].type == ctx->ir_base[ref].type) { cond->op2 = ref; - return 1; + return true; } } else if (cond->op == IR_GE) { /* (x >= 3 ? 2 : x) => (x > 2 ? 2 : x) => min(x, 2) */ @@ -2725,10 +2725,10 @@ static bool ir_fix_min_max_const(ir_ctx *ctx, ir_insn *cond, ir_ref ref) && ctx->ir_base[cond->op2].val.i64 == ctx->ir_base[ref].val.i64 + 1 && ctx->ir_base[cond->op2].type == ctx->ir_base[ref].type) { cond->op2 = ref; - return 1; + return true; } } - return 0; + return false; } static bool ir_optimize_phi(ir_ctx *ctx, ir_ref merge_ref, ir_insn *merge, ir_ref ref, ir_insn *insn) @@ -2857,7 +2857,7 @@ static bool ir_optimize_phi(ir_ctx *ctx, ir_ref merge_ref, ir_insn *merge, ir_re ir_bitqueue_add(ctx->iter_worklist, next->op1); } - return 1; + return true; } else if (is_cmp && ((ctx->ir_base[insn->op2].op == IR_NEG && ctx->use_lists[insn->op2].count == 1 @@ -2950,7 +2950,7 @@ static bool ir_optimize_phi(ir_ctx *ctx, ir_ref merge_ref, ir_insn *merge, ir_re ir_bitqueue_add(ctx->iter_worklist, next->op1); } - return 1; + return true; } else if (insn->op2 <= root_ref && insn->op3 <= root_ref && cond->op != IR_OVERFLOW // TODO: temporary disable IF-conversion for RLOAD. @@ -3020,13 +3020,13 @@ static bool ir_optimize_phi(ir_ctx *ctx, ir_ref merge_ref, ir_insn *merge, ir_re ir_bitqueue_add(ctx->iter_worklist, next->op1); } - return 1; + return true; } } } } - return 0; + return false; } static bool ir_cmp_is_true(ir_op op, const ir_insn *op1, const ir_insn *op2) @@ -3071,7 +3071,7 @@ static bool ir_cmp_is_true(ir_op op, const ir_insn *op1, const ir_insn *op2) return op1->val.u64 > op2->val.u64; } else { IR_ASSERT(0); - return 0; + return false; } } else if (op1->type == IR_DOUBLE) { if (op == IR_EQ) { @@ -3100,7 +3100,7 @@ static bool ir_cmp_is_true(ir_op op, const ir_insn *op1, const ir_insn *op2) return isnan(op1->val.d) || isnan(op2->val.d); } else { IR_ASSERT(0); - return 0; + return false; } } else { IR_ASSERT(op1->type == IR_FLOAT); @@ -3130,7 +3130,7 @@ static bool ir_cmp_is_true(ir_op op, const ir_insn *op1, const ir_insn *op2) return isnan(op1->val.f) || isnan(op2->val.f); } else { IR_ASSERT(0); - return 0; + return false; } } } @@ -3212,7 +3212,7 @@ static bool ir_try_split_if(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_bitqueue_add(ctx->iter_worklist, if_false_ref); ir_bitqueue_add(ctx->iter_worklist, if_true_ref); - return 1; + return true; } else { /* Simple IF Split * @@ -3251,7 +3251,7 @@ static bool ir_try_split_if(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_bitqueue_add(ctx->iter_worklist, if_false_ref); - return 1; + return true; } } @@ -3307,12 +3307,12 @@ static bool ir_try_split_if(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_bitqueue_add(ctx->iter_worklist, end2->op1); } - return 1; + return true; } } } - return 0; + return false; } static bool ir_try_split_if_cmp(ir_ctx *ctx, ir_ref ref, ir_insn *insn) @@ -3404,7 +3404,7 @@ static bool ir_try_split_if_cmp(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_bitqueue_add(ctx->iter_worklist, if_false_ref); ir_bitqueue_add(ctx->iter_worklist, if_true_ref); - return 1; + return true; } else { /* IF Split * @@ -3447,7 +3447,7 @@ static bool ir_try_split_if_cmp(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_bitqueue_add(ctx->iter_worklist, if_false_ref); - return 1; + return true; } } else { /* IF Split @@ -3507,14 +3507,14 @@ static bool ir_try_split_if_cmp(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_bitqueue_add(ctx->iter_worklist, end2->op1); } - return 1; + return true; } } } } } - return 0; + return false; } static void ir_iter_optimize_merge(ir_ctx *ctx, ir_ref merge_ref, ir_insn *merge) diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index 80d3287a4204..bfda1b4c4cc0 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -128,7 +128,7 @@ static bool zend_ssa_is_last_use(const zend_op_array *op_array, const zend_ssa * zend_ssa_phi *phi = ssa->vars[var].phi_use_chain; do { if (!ssa->vars[phi->ssa_var].no_val) { - return 0; + return false; } phi = zend_ssa_next_use_phi(ssa, var, phi); } while (phi); @@ -148,14 +148,14 @@ static bool zend_ssa_is_last_use(const zend_op_array *op_array, const zend_ssa * } if (dominates(ssa->cfg.blocks, def_block, (ssa->cfg.blocks[b].flags & ZEND_BB_LOOP_HEADER) ? b : ssa->cfg.blocks[b].loop_header)) { - return 0; + return false; } while (prev_use >= 0 && prev_use != use) { if (b != ssa->cfg.map[prev_use] && dominates(ssa->cfg.blocks, b, ssa->cfg.map[prev_use]) && !zend_ssa_is_no_val_use(op_array->opcodes + prev_use, ssa->ops + prev_use, var)) { - return 0; + return false; } prev_use = zend_ssa_next_use(ssa->ops, var, prev_use); } @@ -163,11 +163,11 @@ static bool zend_ssa_is_last_use(const zend_op_array *op_array, const zend_ssa * next_use = zend_ssa_next_use(ssa->ops, var, use); if (next_use < 0) { - return 1; + return true; } else if (zend_ssa_is_no_val_use(op_array->opcodes + next_use, ssa->ops + next_use, var)) { - return 1; + return true; } - return 0; + return false; } static int zend_jit_is_constant_cmp_long_long(const zend_op *opline, @@ -515,7 +515,7 @@ static bool zend_jit_may_avoid_refcounting(const zend_op *opline, uint32_t op1_i if (!JIT_G(current_frame) || !JIT_G(current_frame)->call->func || !TRACE_FRAME_IS_LAST_SEND_BY_VAL(JIT_G(current_frame)->call)) { - return 0; + return false; } /* break missing intentionally */ case ZEND_FETCH_OBJ_R: @@ -524,26 +524,26 @@ static bool zend_jit_may_avoid_refcounting(const zend_op *opline, uint32_t op1_i && opline->op2_type == IS_CONST && Z_TYPE_P(RT_CONSTANT(opline, opline->op2)) == IS_STRING && Z_STRVAL_P(RT_CONSTANT(opline, opline->op2))[0] != '\0') { - return 1; + return true; } break; case ZEND_FETCH_DIM_FUNC_ARG: if (!JIT_G(current_frame) || !JIT_G(current_frame)->call->func || !TRACE_FRAME_IS_LAST_SEND_BY_VAL(JIT_G(current_frame)->call)) { - return 0; + return false; } /* break missing intentionally */ case ZEND_FETCH_DIM_R: case ZEND_FETCH_DIM_IS: - return 1; + return true; case ZEND_ISSET_ISEMPTY_DIM_OBJ: if (!(opline->extended_value & ZEND_ISEMPTY)) { - return 1; + return true; } break; } - return 0; + return false; } static bool zend_jit_is_persistent_constant(zval *key, uint32_t flags) @@ -677,13 +677,13 @@ static bool zend_may_be_dynamic_property(zend_class_entry *ce, zend_string *memb zend_property_info *info; if (!ce || (ce->ce_flags & ZEND_ACC_TRAIT) || (op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) { - return 1; + return true; } if (!(ce->ce_flags & ZEND_ACC_IMMUTABLE)) { if (ce->info.user.filename != op_array->filename) { /* class declaration might be changed independently */ - return 1; + return true; } } @@ -693,15 +693,15 @@ static bool zend_may_be_dynamic_property(zend_class_entry *ce, zend_string *memb !IS_VALID_PROPERTY_OFFSET(info->offset) || (info->flags & ZEND_ACC_STATIC) || info->hooks) { - return 1; + return true; } if (!(info->flags & ZEND_ACC_PUBLIC) && (!on_this || info->ce != ce)) { - return 1; + return true; } - return 0; + return false; } static bool zend_jit_class_may_be_modified(const zend_class_entry *ce, const zend_op_array *called_from) @@ -711,47 +711,47 @@ static bool zend_jit_class_may_be_modified(const zend_class_entry *ce, const zen if (ce->type == ZEND_INTERNAL_CLASS) { #ifdef _WIN32 /* ASLR */ - return 1; + return true; #else - return 0; + return false; #endif } else if (ce->type == ZEND_USER_CLASS) { if (ce->ce_flags & ZEND_ACC_PRELOADED) { - return 0; + return false; } if (ce->info.user.filename == called_from->filename) { if (ce->parent && (!(ce->ce_flags & ZEND_ACC_LINKED) || zend_jit_class_may_be_modified(ce->parent, called_from))) { - return 1; + return true; } if (ce->num_interfaces) { if (!(ce->ce_flags & ZEND_ACC_LINKED)) { - return 1; + return true; } for (i = 0; i < ce->num_interfaces; i++) { if (zend_jit_class_may_be_modified(ce->interfaces[i], called_from)) { - return 1; + return true; } } } if (ce->num_traits) { if (!(ce->ce_flags & ZEND_ACC_LINKED)) { - return 1; + return true; } for (i=0; i < ce->num_traits; i++) { zend_class_entry *trait = zend_fetch_class_by_name(ce->trait_names[i].name, ce->trait_names[i].lc_name, ZEND_FETCH_CLASS_TRAIT | ZEND_FETCH_CLASS_NO_AUTOLOAD | ZEND_FETCH_CLASS_SILENT); if (!trait || zend_jit_class_may_be_modified(trait, called_from)) { - return 1; + return true; } } } - return 0; + return false; } } - return 1; + return true; } static bool zend_jit_may_be_modified(const zend_function *func, const zend_op_array *called_from) @@ -759,21 +759,21 @@ static bool zend_jit_may_be_modified(const zend_function *func, const zend_op_ar if (func->type == ZEND_INTERNAL_FUNCTION) { #ifdef _WIN32 /* ASLR */ - return 1; + return true; #else - return 0; + return false; #endif } else if (func->type == ZEND_USER_FUNCTION) { if (func->common.fn_flags & ZEND_ACC_PRELOADED) { - return 0; + return false; } if (func->op_array.filename == called_from->filename && (!func->op_array.scope || !zend_jit_class_may_be_modified(func->op_array.scope, called_from))) { - return 0; + return false; } } - return 1; + return true; } #define OP_RANGE(ssa_op, opN) \ @@ -1388,9 +1388,9 @@ static bool zend_jit_next_is_send_result(const zend_op *opline) && (opline+1)->op1_type == IS_TMP_VAR && (opline+1)->op2_type != IS_CONST && (opline+1)->op1.var == opline->result.var) { - return 1; + return true; } - return 0; + return false; } static bool zend_jit_supported_binary_op(uint8_t op, uint32_t op1_info, uint32_t op2_info) diff --git a/sapi/apache2handler/apache_config.c b/sapi/apache2handler/apache_config.c index 1f9447e62938..21a70b5c07a4 100644 --- a/sapi/apache2handler/apache_config.c +++ b/sapi/apache2handler/apache_config.c @@ -122,15 +122,15 @@ static bool should_overwrite_per_dir_entry(HashTable *target_ht, zval *zv, zend_ php_dir_entry *orig_per_dir_entry; if ((orig_per_dir_entry = zend_hash_find_ptr(target_ht, hash_key->key)) == NULL) { - return 1; /* does not exist in dest, copy from source */ + return true; /* does not exist in dest, copy from source */ } if (new_per_dir_entry->status >= orig_per_dir_entry->status) { /* use new entry */ phpapdebug((stderr, "ADDING/OVERWRITING %s (%d vs. %d)\n", ZSTR_VAL(hash_key->key), new_per_dir_entry->status, orig_per_dir_entry->status)); - return 1; + return true; } else { - return 0; + return false; } } From 20bba22aa46f194a1f2925e706823c32ce806686 Mon Sep 17 00:00:00 2001 From: arshidkv12 Date: Mon, 5 Oct 2026 12:54:24 +0530 Subject: [PATCH 2/3] Use true and false for bool return values --- ext/opcache/jit/ir/ir.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/opcache/jit/ir/ir.c b/ext/opcache/jit/ir/ir.c index c8f602d6d781..120722b2dcad 100644 --- a/ext/opcache/jit/ir/ir.c +++ b/ext/opcache/jit/ir/ir.c @@ -1650,7 +1650,7 @@ bool ir_use_list_add(ir_ctx *ctx, ir_ref to, ir_ref ref) if (n < ctx->use_edges_count && ctx->use_edges[n] == IR_UNUSED) { ctx->use_edges[n] = ref; use_list->count++; - return false; + return 0; } else { size_t old_size = IR_ALIGNED_SIZE(ctx->use_edges_count * sizeof(ir_ref), 4096); size_t new_size = IR_ALIGNED_SIZE((ctx->use_edges_count + use_list->count + 1) * sizeof(ir_ref), 4096); @@ -1662,13 +1662,13 @@ bool ir_use_list_add(ir_ctx *ctx, ir_ref to, ir_ref ref) ctx->use_edges[n] = ref; use_list->count++; ctx->use_edges_count++; - return true; + return 1; } } else if (n == ctx->use_edges_count) { ctx->use_edges[n] = ref; use_list->count++; ctx->use_edges_count++; - return false; + return 0; } if (use_list->count) { memcpy(ctx->use_edges + ctx->use_edges_count, ctx->use_edges + use_list->refs, use_list->count * sizeof(ir_ref)); @@ -1677,7 +1677,7 @@ bool ir_use_list_add(ir_ctx *ctx, ir_ref to, ir_ref ref) ctx->use_edges[use_list->refs + use_list->count] = ref; use_list->count++; ctx->use_edges_count += use_list->count; - return true; + return 1; } } @@ -1908,7 +1908,7 @@ bool ir_hashtab_add(ir_hashtab *tab, uint32_t key, ir_ref val) key |= tab->mask; p->next = ((uint32_t*)data)[(int32_t)key]; ((uint32_t*)data)[(int32_t)key] = pos; - return true; + return 1; } static int ir_hashtab_key_cmp(const void *b1, const void *b2) From bdad5d82de3b1aa058cc0b8b82b90ca5ca448ea7 Mon Sep 17 00:00:00 2001 From: arshidkv12 Date: Mon, 5 Oct 2026 12:56:59 +0530 Subject: [PATCH 3/3] Use true and false for bool return values --- ext/opcache/jit/ir/ir_cfg.c | 8 +-- ext/opcache/jit/ir/ir_check.c | 8 +-- ext/opcache/jit/ir/ir_emit.c | 30 ++++---- ext/opcache/jit/ir/ir_gdb.c | 4 +- ext/opcache/jit/ir/ir_sccp.c | 126 +++++++++++++++++----------------- ext/opcache/jit/zend_jit.c | 68 +++++++++--------- 6 files changed, 122 insertions(+), 122 deletions(-) diff --git a/ext/opcache/jit/ir/ir_cfg.c b/ext/opcache/jit/ir/ir_cfg.c index 7512f8b0a2eb..4e4db166d37e 100644 --- a/ext/opcache/jit/ir/ir_cfg.c +++ b/ext/opcache/jit/ir/ir_cfg.c @@ -1540,7 +1540,7 @@ static bool ir_is_merged_loop_back_edge(ir_ctx *ctx, uint32_t hdr, uint32_t b) } return b == hdr; } - return false; + return 0; } #endif @@ -1552,13 +1552,13 @@ static bool ir_should_align_loop(ir_ctx *ctx, ir_chain *chains, uint32_t b, ir_b for (; n > 0; p++, n--) { uint32_t pred = *p; if (chains[pred].head) { - if (ir_chain_head(chains, pred) == b) return true; + if (ir_chain_head(chains, pred) == b) return 1; } else { - if (ir_should_align_loop(ctx, chains, b, &ctx->cfg_blocks[pred])) return true; + if (ir_should_align_loop(ctx, chains, b, &ctx->cfg_blocks[pred])) return 1; } } - return false; + return 0; } static int ir_schedule_blocks_bottom_up(ir_ctx *ctx) diff --git a/ext/opcache/jit/ir/ir_check.c b/ext/opcache/jit/ir/ir_check.c index d5f5cc93d876..fd7ba4478abe 100644 --- a/ext/opcache/jit/ir/ir_check.c +++ b/ext/opcache/jit/ir/ir_check.c @@ -78,10 +78,10 @@ static bool ir_check_use_list(ir_check_ctx *check_ctx, const ir_ctx *ctx, ir_ref } for (p = &ctx->use_edges[use_list->refs]; n > 0; p++, n--) { if (*p == to) { - return true; + return 1; } } - return false; + return 0; } static bool ir_check_input_list(ir_check_ctx *check_ctx, const ir_ctx *ctx, ir_ref from, ir_ref to) @@ -115,10 +115,10 @@ static bool ir_check_input_list(ir_check_ctx *check_ctx, const ir_ctx *ctx, ir_r } for (j = 1, p = insn->ops + 1; j <= n; j++, p++) { if (*p == from) { - return true; + return 1; } } - return false; + return 0; } static bool ir_check_domination(const ir_ctx *ctx, ir_ref def, ir_ref use) diff --git a/ext/opcache/jit/ir/ir_emit.c b/ext/opcache/jit/ir/ir_emit.c index bfacea04aaa8..8c01f56c9e30 100644 --- a/ext/opcache/jit/ir/ir_emit.c +++ b/ext/opcache/jit/ir/ir_emit.c @@ -247,7 +247,7 @@ static bool ir_is_same_mem_var(const ir_ctx *ctx, ir_ref r1, int32_t offset) int32_t o1; if (IR_IS_CONST_REF(r1)) { - return false; + return 0; } IR_ASSERT(ctx->vregs[r1]); @@ -1058,9 +1058,9 @@ static void ir_emit_dessa_moves(ir_ctx *ctx, int b, ir_block *bb) /* TAILCALL optimization */ static bool ir_may_be_local_addr(ir_ctx *ctx, ir_insn *insn) { - if (insn->op == IR_PARAM) return false; + if (insn->op == IR_PARAM) return 0; - return true; + return 1; } static bool ir_try_tailcall(ir_ctx *ctx, ir_ref ref, ir_insn *insn) @@ -1078,7 +1078,7 @@ static bool ir_try_tailcall(ir_ctx *ctx, ir_ref ref, ir_insn *insn) if (rule) { ctx->rules[ref] = rule; - return false; + return 0; } proto_ref = func->proto; } else if (func->op == IR_FUNC_ADDR) { @@ -1088,10 +1088,10 @@ static bool ir_try_tailcall(ir_ctx *ctx, ir_ref ref, ir_insn *insn) proto_ref = ctx->ir_base[insn->op2].op2; } - if (!proto_ref) return false; + if (!proto_ref) return 0; proto = (const ir_proto_t *)ir_get_str(ctx, proto_ref); - if ((proto->flags & IR_CALL_CONV_MASK) != (ctx->flags & IR_CALL_CONV_MASK)) return false; + if ((proto->flags & IR_CALL_CONV_MASK) != (ctx->flags & IR_CALL_CONV_MASK)) return 0; cc = ir_get_call_conv_dsc(proto ? proto->flags : IR_CC_DEFAULT); copy_stack = 0; @@ -1101,7 +1101,7 @@ static bool ir_try_tailcall(ir_ctx *ctx, ir_ref ref, ir_insn *insn) } // TODO: "params_stack_size" must match the "args_stack_size" - if (params_stack_size) return false; + if (params_stack_size) return 0; /* check for passing addresses of local variable */ uint32_t n = insn->inputs_count; @@ -1110,7 +1110,7 @@ static bool ir_try_tailcall(ir_ctx *ctx, ir_ref ref, ir_insn *insn) if (!IR_IS_CONST_REF(input) && ctx->ir_base[input].type == IR_ADDR) { /* Passing addrss of local varible to TAILCALL is disallowd */ if (ir_may_be_local_addr(ctx, &ctx->ir_base[input])) { - return false; + return 0; } } } @@ -1134,7 +1134,7 @@ static bool ir_try_tailcall(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ctx->rules[ref] = IR_TAILCALL | IR_NO_REG; - return true; + return 1; } #if 0 @@ -1558,19 +1558,19 @@ static bool ir_load_may_reuse_var_slot(ir_ctx *ctx, ir_block *bb, ir_ref var, ir if (n) { for (p = ctx->use_edges + use_list->refs; n > 0; p++, n--) { use = *p; - if (use < load || use > bb->end) return false; + if (use < load || use > bb->end) return 0; if (use > last_use) last_use = use; } for (i = load + 1, insn = &ctx->ir_base[i]; i < last_use;) { if ((insn->op == IR_VSTORE || insn->op == IR_VSTORE_v) && insn->op2 == var) { - return false; + return 0; } n = ir_insn_len(insn); i += n; insn += n; } } - return true; + return 1; } static bool ir_store_may_reuse_var_slot(ir_ctx *ctx, ir_block *bb, ir_ref var, ir_ref store, ir_ref val) @@ -1578,18 +1578,18 @@ static bool ir_store_may_reuse_var_slot(ir_ctx *ctx, ir_block *bb, ir_ref var, i ir_ref i, n; ir_insn *insn; - if (val < bb->start && val > store) return false; + if (val < bb->start && val > store) return 0; for (i = val, insn = &ctx->ir_base[i]; i < store;) { if ((insn->op == IR_VLOAD || insn->op == IR_VLOAD_v || insn->op == IR_VSTORE || insn->op == IR_VSTORE_v) && insn->op2 == var) { - return false; + return 0; } n = ir_insn_len(insn); i += n; insn += n; } - return true; + return 1; } static void ir_add_fusion_data(ir_ctx *ctx, ir_ref ref, ir_ref input, ir_reg_alloc_simple_data *x) diff --git a/ext/opcache/jit/ir/ir_gdb.c b/ext/opcache/jit/ir/ir_gdb.c index 3e2c8769e69a..5f1bde3fff00 100644 --- a/ext/opcache/jit/ir/ir_gdb.c +++ b/ext/opcache/jit/ir/ir_gdb.c @@ -534,7 +534,7 @@ static bool ir_gdb_register_code(const void *object, size_t size) entry = malloc(sizeof(ir_gdbjit_code_entry) + size); if (entry == NULL) { - return false; + return 0; } entry->symfile_addr = ((char*)entry) + sizeof(ir_gdbjit_code_entry); @@ -566,7 +566,7 @@ static bool ir_gdb_register_code(const void *object, size_t size) __jit_debug_descriptor.action_flag = IR_GDBJIT_REGISTER; __jit_debug_register_code(); - return true; + return 1; } void ir_gdb_unregister_all(void) diff --git a/ext/opcache/jit/ir/ir_sccp.c b/ext/opcache/jit/ir/ir_sccp.c index 1e9cde9a7a96..4745c7000d72 100644 --- a/ext/opcache/jit/ir/ir_sccp.c +++ b/ext/opcache/jit/ir/ir_sccp.c @@ -378,7 +378,7 @@ static bool ir_sccp_analyze_phi(const ir_ctx *ctx, ir_sccp_val *_values, ir_bitq #endif if (!IR_IS_REACHABLE(insn->op1)) { - return false; + return 0; } n = insn->inputs_count; if (n > 3 && _values[i].op == IR_TOP) { @@ -441,7 +441,7 @@ static bool ir_sccp_analyze_phi(const ir_ctx *ctx, ir_sccp_val *_values, ir_bitq goto next; } - return false; + return 0; next: p++; @@ -515,7 +515,7 @@ static bool ir_sccp_analyze_phi(const ir_ctx *ctx, ir_sccp_val *_values, ir_bitq make_bottom: IR_MAKE_BOTTOM_EX(i); - return true; + return 1; } static bool ir_is_dead_load_ex(const ir_ctx *ctx, ir_ref ref, uint32_t flags, const ir_insn *insn) @@ -525,7 +525,7 @@ static bool ir_is_dead_load_ex(const ir_ctx *ctx, ir_ref ref, uint32_t flags, co } else if (insn->op == IR_ALLOCA || insn->op == IR_BLOCK_BEGIN) { return ctx->use_lists[ref].count == 1; } - return false; + return 0; } static bool ir_is_dead_load(const ir_ctx *ctx, ir_ref ref) @@ -535,12 +535,12 @@ static bool ir_is_dead_load(const ir_ctx *ctx, ir_ref ref) uint32_t flags = ir_op_flags[insn->op]; if ((flags & (IR_OP_FLAG_MEM|IR_OP_FLAG_MEM_MASK)) == (IR_OP_FLAG_MEM|IR_OP_FLAG_MEM_LOAD)) { - return true; + return 1; } else if (insn->op == IR_ALLOCA || insn->op == IR_BLOCK_BEGIN) { - return true; + return 1; } } - return false; + return 0; } static bool ir_is_dead(const ir_ctx *ctx, ir_ref ref) @@ -550,7 +550,7 @@ static bool ir_is_dead(const ir_ctx *ctx, ir_ref ref) } else { return ir_is_dead_load(ctx, ref); } - return false; + return 0; } static bool ir_sccp_is_true(const ir_ctx *ctx, const ir_sccp_val *_values, ir_ref a) @@ -1078,7 +1078,7 @@ static bool ir_sccp_remove_unfeasible_merge_inputs(ir_ctx *ctx, ir_ref ref, ir_i if (life_inputs != &holder) { ir_mem_free(life_inputs); } - return false; + return 0; } for (i = new_merge_inputs + 1; i <= old_merge_inputs; i++) { @@ -1170,7 +1170,7 @@ static bool ir_sccp_remove_unfeasible_merge_inputs(ir_ctx *ctx, ir_ref ref, ir_i ir_mem_free(life_inputs); } - return true; + return 1; } static IR_NEVER_INLINE void ir_sccp_transform(ir_ctx *ctx, const ir_sccp_val *_values, ir_bitqueue *worklist, ir_bitqueue *iter_worklist) @@ -1603,7 +1603,7 @@ static bool ir_may_promote_d2f(const ir_ctx *ctx, ir_ref ref) } else { switch (insn->op) { case IR_FP2FP: - return true; + return 1; // case IR_INT2FP: // return ctx->use_lists[ref].count == 1; case IR_NEG: @@ -1623,7 +1623,7 @@ static bool ir_may_promote_d2f(const ir_ctx *ctx, ir_ref ref) break; } } - return false; + return 0; } static bool ir_may_promote_f2d(const ir_ctx *ctx, ir_ref ref) @@ -1636,7 +1636,7 @@ static bool ir_may_promote_f2d(const ir_ctx *ctx, ir_ref ref) } else { switch (insn->op) { case IR_FP2FP: - return true; + return 1; // case IR_INT2FP: // return ctx->use_lists[ref].count == 1; case IR_NEG: @@ -1656,7 +1656,7 @@ static bool ir_may_promote_f2d(const ir_ctx *ctx, ir_ref ref) break; } } - return false; + return 0; } static ir_ref ir_promote_d2f(ir_ctx *ctx, ir_ref ref, ir_ref use) @@ -1873,7 +1873,7 @@ static bool ir_may_promote_trunc(const ir_ctx *ctx, ir_type type, ir_ref ref) for (p = &ctx->use_edges[use_list->refs], n = use_list->count; n > 0; p++, n--) { if (*p != ref) { if (count) { - return false; + return 0; } count = 1; } @@ -1883,16 +1883,16 @@ static bool ir_may_promote_trunc(const ir_ctx *ctx, ir_type type, ir_ref ref) input = *p; if (input != ref) { if (!ir_may_promote_trunc(ctx, type, input)) { - return false; + return 0; } } } - return true; + return 1; default: break; } } - return false; + return 0; } static ir_ref ir_promote_i2i(ir_ctx *ctx, ir_type type, ir_ref ref, ir_ref use) @@ -2183,17 +2183,17 @@ static bool ir_is_loop_invariant(const ir_ctx *ctx, ir_ref ref, ir_ref loop) static bool ir_is_cheaper_ext(const ir_ctx *ctx, ir_ref ref, ir_ref loop, ir_ref ext_ref, ir_op op) { if (IR_IS_CONST_REF(ref)) { - return true; + return 1; } else { const ir_insn *insn = &ctx->ir_base[ref]; if (insn->op == IR_LOAD) { if (ir_is_loop_invariant(ctx, ref, loop)) { - return true; + return 1; } else { /* ZEXT(LOAD(_, _)) costs the same as LOAD(_, _) */ if (ctx->use_lists[ref].count == 2) { - return true; + return 1; } else if (ctx->use_lists[ref].count == 3) { ir_use_list *use_list = &ctx->use_lists[ref]; ir_ref *p, n, use; @@ -2206,14 +2206,14 @@ static bool ir_is_cheaper_ext(const ir_ctx *ctx, ir_ref ref, ir_ref loop, ir_ref if (use_insn->op != op && (!(ir_op_flags[use_insn->op] & (IR_OP_FLAG_CONTROL|IR_OP_FLAG_MEM)) || use_insn->op1 != ref)) { - return false; + return 0; } } } - return true; + return 1; } } - return false; + return 0; } else { return ir_is_loop_invariant(ctx, ref, loop); } @@ -2242,27 +2242,27 @@ static bool ir_try_promote_induction_var_ext(ir_ctx *ctx, ir_ref ext_ref, ir_ref if (use_insn->op >= IR_EQ && use_insn->op <= IR_UGT) { if (use_insn->op1 == phi_ref) { if (IR_IS_TYPE_SIGNED(type) != IR_IS_TYPE_SIGNED(ctx->ir_base[use_insn->op2].type)) { - return false; + return 0; } if (ir_is_cheaper_ext(ctx, use_insn->op2, ctx->ir_base[phi_ref].op1, ext_ref, op)) { continue; } } else if (use_insn->op2 == phi_ref) { if (IR_IS_TYPE_SIGNED(type) != IR_IS_TYPE_SIGNED(ctx->ir_base[use_insn->op1].type)) { - return false; + return 0; } if (ir_is_cheaper_ext(ctx, use_insn->op1, ctx->ir_base[phi_ref].op1, ext_ref, op)) { continue; } } - return false; + return 0; } else if (use_insn->op == IR_IF) { continue; } else if (!ext_ref_2 && use_insn->op == op && use_insn->type == type) { ext_ref_2 = use; continue; } else { - return false; + return 0; } } } @@ -2281,27 +2281,27 @@ static bool ir_try_promote_induction_var_ext(ir_ctx *ctx, ir_ref ext_ref, ir_ref if (use_insn->op >= IR_EQ && use_insn->op <= IR_UGT) { if (use_insn->op1 == op_ref) { if (IR_IS_TYPE_SIGNED(type) != IR_IS_TYPE_SIGNED(ctx->ir_base[use_insn->op2].type)) { - return false; + return 0; } if (ir_is_cheaper_ext(ctx, use_insn->op2, ctx->ir_base[phi_ref].op1, ext_ref, op)) { continue; } } else if (use_insn->op2 == op_ref) { if (IR_IS_TYPE_SIGNED(type) != IR_IS_TYPE_SIGNED(ctx->ir_base[use_insn->op1].type)) { - return false; + return 0; } if (ir_is_cheaper_ext(ctx, use_insn->op1, ctx->ir_base[phi_ref].op1, ext_ref, op)) { continue; } } - return false; + return 0; } else if (use_insn->op == IR_IF) { continue; } else if (!ext_ref_2 && use_insn->op == op && use_insn->type == type) { ext_ref_2 = use; continue; } else { - return false; + return 0; } } } @@ -2409,7 +2409,7 @@ static bool ir_try_promote_induction_var_ext(ir_ctx *ctx, ir_ref ext_ref, ir_ref ctx->ir_base[phi_ref].op2 = tmp; } - return true; + return 1; } static bool ir_try_promote_ext(ir_ctx *ctx, ir_ref ext_ref, ir_insn *insn) @@ -2467,7 +2467,7 @@ static bool ir_try_promote_ext(ir_ctx *ctx, ir_ref ext_ref, ir_insn *insn) ir_iter_replace_insn(ctx, ext_ref, ref); } - return false; + return 0; } static void ir_get_true_false_refs(const ir_ctx *ctx, ir_ref if_ref, ir_ref *if_true_ref, ir_ref *if_false_ref) @@ -2541,7 +2541,7 @@ static bool ir_try_remove_empty_diamond(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_insn *end2 = &ctx->ir_base[end2_ref]; if (end1->op != IR_END || end2->op != IR_END) { - return false; + return 0; } ir_ref start1_ref = end1->op1, start2_ref = end2->op1; @@ -2549,7 +2549,7 @@ static bool ir_try_remove_empty_diamond(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_insn *start2 = &ctx->ir_base[start2_ref]; if (start1->op1 != start2->op1) { - return false; + return 0; } ir_ref root_ref = start1->op1; @@ -2557,7 +2557,7 @@ static bool ir_try_remove_empty_diamond(ir_ctx *ctx, ir_ref ref, ir_insn *insn) if (root->op != IR_IF && !(root->op == IR_SWITCH && ctx->use_lists[root_ref].count == 2)) { - return false; + return 0; } /* Empty Diamond @@ -2609,7 +2609,7 @@ static bool ir_try_remove_empty_diamond(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_bitqueue_add(ctx->iter_worklist, next->op1); } - return true; + return 1; } else { ir_ref i, count = insn->inputs_count, *ops = insn->ops + 1; ir_ref root_ref = IR_UNUSED; @@ -2621,12 +2621,12 @@ static bool ir_try_remove_empty_diamond(ir_ctx *ctx, ir_ref ref, ir_insn *insn) end_ref = ops[i]; end = &ctx->ir_base[end_ref]; if (end->op != IR_END) { - return false; + return 0; } start_ref = end->op1; start = &ctx->ir_base[start_ref]; if (start->op != IR_CASE_VAL && start->op != IR_CASE_RANGE && start->op != IR_CASE_DEFAULT) { - return false; + return 0; } if (ctx->use_lists[start_ref].count != 1) { ir_remove_unused_vars(ctx, start_ref, end_ref); @@ -2634,10 +2634,10 @@ static bool ir_try_remove_empty_diamond(ir_ctx *ctx, ir_ref ref, ir_insn *insn) if (!root_ref) { root_ref = start->op1; if (ctx->use_lists[root_ref].count != count) { - return false; + return 0; } } else if (start->op1 != root_ref) { - return false; + return 0; } } @@ -2674,7 +2674,7 @@ static bool ir_try_remove_empty_diamond(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_bitqueue_add(ctx->iter_worklist, next->op1); } - return true; + return 1; } } @@ -2695,7 +2695,7 @@ static bool ir_fix_min_max_const(ir_ctx *ctx, ir_insn *cond, ir_ref ref) && ctx->ir_base[cond->op2].val.u64 == ctx->ir_base[ref].val.u64 - 1 && ctx->ir_base[cond->op2].type == ctx->ir_base[ref].type) { cond->op2 = ref; - return true; + return 1; } } else if (cond->op == IR_UGE) { /* (x >= 3 ? 2 : x) => (x > 2 ? 2 : x) => min(x, 2) */ @@ -2705,7 +2705,7 @@ static bool ir_fix_min_max_const(ir_ctx *ctx, ir_insn *cond, ir_ref ref) && ctx->ir_base[cond->op2].val.u64 == ctx->ir_base[ref].val.u64 + 1 && ctx->ir_base[cond->op2].type == ctx->ir_base[ref].type) { cond->op2 = ref; - return true; + return 1; } } else if (cond->op == IR_LE) { /* (x <= 3 ? 4 : x) => (x < 4 ? 4 : x) => max(x, 4) */ @@ -2715,7 +2715,7 @@ static bool ir_fix_min_max_const(ir_ctx *ctx, ir_insn *cond, ir_ref ref) && ctx->ir_base[cond->op2].val.u64 == ctx->ir_base[ref].val.u64 - 1 && ctx->ir_base[cond->op2].type == ctx->ir_base[ref].type) { cond->op2 = ref; - return true; + return 1; } } else if (cond->op == IR_GE) { /* (x >= 3 ? 2 : x) => (x > 2 ? 2 : x) => min(x, 2) */ @@ -2725,10 +2725,10 @@ static bool ir_fix_min_max_const(ir_ctx *ctx, ir_insn *cond, ir_ref ref) && ctx->ir_base[cond->op2].val.i64 == ctx->ir_base[ref].val.i64 + 1 && ctx->ir_base[cond->op2].type == ctx->ir_base[ref].type) { cond->op2 = ref; - return true; + return 1; } } - return false; + return 0; } static bool ir_optimize_phi(ir_ctx *ctx, ir_ref merge_ref, ir_insn *merge, ir_ref ref, ir_insn *insn) @@ -2857,7 +2857,7 @@ static bool ir_optimize_phi(ir_ctx *ctx, ir_ref merge_ref, ir_insn *merge, ir_re ir_bitqueue_add(ctx->iter_worklist, next->op1); } - return true; + return 1; } else if (is_cmp && ((ctx->ir_base[insn->op2].op == IR_NEG && ctx->use_lists[insn->op2].count == 1 @@ -2950,7 +2950,7 @@ static bool ir_optimize_phi(ir_ctx *ctx, ir_ref merge_ref, ir_insn *merge, ir_re ir_bitqueue_add(ctx->iter_worklist, next->op1); } - return true; + return 1; } else if (insn->op2 <= root_ref && insn->op3 <= root_ref && cond->op != IR_OVERFLOW // TODO: temporary disable IF-conversion for RLOAD. @@ -3020,13 +3020,13 @@ static bool ir_optimize_phi(ir_ctx *ctx, ir_ref merge_ref, ir_insn *merge, ir_re ir_bitqueue_add(ctx->iter_worklist, next->op1); } - return true; + return 1; } } } } - return false; + return 0; } static bool ir_cmp_is_true(ir_op op, const ir_insn *op1, const ir_insn *op2) @@ -3071,7 +3071,7 @@ static bool ir_cmp_is_true(ir_op op, const ir_insn *op1, const ir_insn *op2) return op1->val.u64 > op2->val.u64; } else { IR_ASSERT(0); - return false; + return 0; } } else if (op1->type == IR_DOUBLE) { if (op == IR_EQ) { @@ -3100,7 +3100,7 @@ static bool ir_cmp_is_true(ir_op op, const ir_insn *op1, const ir_insn *op2) return isnan(op1->val.d) || isnan(op2->val.d); } else { IR_ASSERT(0); - return false; + return 0; } } else { IR_ASSERT(op1->type == IR_FLOAT); @@ -3130,7 +3130,7 @@ static bool ir_cmp_is_true(ir_op op, const ir_insn *op1, const ir_insn *op2) return isnan(op1->val.f) || isnan(op2->val.f); } else { IR_ASSERT(0); - return false; + return 0; } } } @@ -3212,7 +3212,7 @@ static bool ir_try_split_if(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_bitqueue_add(ctx->iter_worklist, if_false_ref); ir_bitqueue_add(ctx->iter_worklist, if_true_ref); - return true; + return 1; } else { /* Simple IF Split * @@ -3251,7 +3251,7 @@ static bool ir_try_split_if(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_bitqueue_add(ctx->iter_worklist, if_false_ref); - return true; + return 1; } } @@ -3307,12 +3307,12 @@ static bool ir_try_split_if(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_bitqueue_add(ctx->iter_worklist, end2->op1); } - return true; + return 1; } } } - return false; + return 0; } static bool ir_try_split_if_cmp(ir_ctx *ctx, ir_ref ref, ir_insn *insn) @@ -3404,7 +3404,7 @@ static bool ir_try_split_if_cmp(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_bitqueue_add(ctx->iter_worklist, if_false_ref); ir_bitqueue_add(ctx->iter_worklist, if_true_ref); - return true; + return 1; } else { /* IF Split * @@ -3447,7 +3447,7 @@ static bool ir_try_split_if_cmp(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_bitqueue_add(ctx->iter_worklist, if_false_ref); - return true; + return 1; } } else { /* IF Split @@ -3507,14 +3507,14 @@ static bool ir_try_split_if_cmp(ir_ctx *ctx, ir_ref ref, ir_insn *insn) ir_bitqueue_add(ctx->iter_worklist, end2->op1); } - return true; + return 1; } } } } } - return false; + return 0; } static void ir_iter_optimize_merge(ir_ctx *ctx, ir_ref merge_ref, ir_insn *merge) diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index bfda1b4c4cc0..80d3287a4204 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -128,7 +128,7 @@ static bool zend_ssa_is_last_use(const zend_op_array *op_array, const zend_ssa * zend_ssa_phi *phi = ssa->vars[var].phi_use_chain; do { if (!ssa->vars[phi->ssa_var].no_val) { - return false; + return 0; } phi = zend_ssa_next_use_phi(ssa, var, phi); } while (phi); @@ -148,14 +148,14 @@ static bool zend_ssa_is_last_use(const zend_op_array *op_array, const zend_ssa * } if (dominates(ssa->cfg.blocks, def_block, (ssa->cfg.blocks[b].flags & ZEND_BB_LOOP_HEADER) ? b : ssa->cfg.blocks[b].loop_header)) { - return false; + return 0; } while (prev_use >= 0 && prev_use != use) { if (b != ssa->cfg.map[prev_use] && dominates(ssa->cfg.blocks, b, ssa->cfg.map[prev_use]) && !zend_ssa_is_no_val_use(op_array->opcodes + prev_use, ssa->ops + prev_use, var)) { - return false; + return 0; } prev_use = zend_ssa_next_use(ssa->ops, var, prev_use); } @@ -163,11 +163,11 @@ static bool zend_ssa_is_last_use(const zend_op_array *op_array, const zend_ssa * next_use = zend_ssa_next_use(ssa->ops, var, use); if (next_use < 0) { - return true; + return 1; } else if (zend_ssa_is_no_val_use(op_array->opcodes + next_use, ssa->ops + next_use, var)) { - return true; + return 1; } - return false; + return 0; } static int zend_jit_is_constant_cmp_long_long(const zend_op *opline, @@ -515,7 +515,7 @@ static bool zend_jit_may_avoid_refcounting(const zend_op *opline, uint32_t op1_i if (!JIT_G(current_frame) || !JIT_G(current_frame)->call->func || !TRACE_FRAME_IS_LAST_SEND_BY_VAL(JIT_G(current_frame)->call)) { - return false; + return 0; } /* break missing intentionally */ case ZEND_FETCH_OBJ_R: @@ -524,26 +524,26 @@ static bool zend_jit_may_avoid_refcounting(const zend_op *opline, uint32_t op1_i && opline->op2_type == IS_CONST && Z_TYPE_P(RT_CONSTANT(opline, opline->op2)) == IS_STRING && Z_STRVAL_P(RT_CONSTANT(opline, opline->op2))[0] != '\0') { - return true; + return 1; } break; case ZEND_FETCH_DIM_FUNC_ARG: if (!JIT_G(current_frame) || !JIT_G(current_frame)->call->func || !TRACE_FRAME_IS_LAST_SEND_BY_VAL(JIT_G(current_frame)->call)) { - return false; + return 0; } /* break missing intentionally */ case ZEND_FETCH_DIM_R: case ZEND_FETCH_DIM_IS: - return true; + return 1; case ZEND_ISSET_ISEMPTY_DIM_OBJ: if (!(opline->extended_value & ZEND_ISEMPTY)) { - return true; + return 1; } break; } - return false; + return 0; } static bool zend_jit_is_persistent_constant(zval *key, uint32_t flags) @@ -677,13 +677,13 @@ static bool zend_may_be_dynamic_property(zend_class_entry *ce, zend_string *memb zend_property_info *info; if (!ce || (ce->ce_flags & ZEND_ACC_TRAIT) || (op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) { - return true; + return 1; } if (!(ce->ce_flags & ZEND_ACC_IMMUTABLE)) { if (ce->info.user.filename != op_array->filename) { /* class declaration might be changed independently */ - return true; + return 1; } } @@ -693,15 +693,15 @@ static bool zend_may_be_dynamic_property(zend_class_entry *ce, zend_string *memb !IS_VALID_PROPERTY_OFFSET(info->offset) || (info->flags & ZEND_ACC_STATIC) || info->hooks) { - return true; + return 1; } if (!(info->flags & ZEND_ACC_PUBLIC) && (!on_this || info->ce != ce)) { - return true; + return 1; } - return false; + return 0; } static bool zend_jit_class_may_be_modified(const zend_class_entry *ce, const zend_op_array *called_from) @@ -711,47 +711,47 @@ static bool zend_jit_class_may_be_modified(const zend_class_entry *ce, const zen if (ce->type == ZEND_INTERNAL_CLASS) { #ifdef _WIN32 /* ASLR */ - return true; + return 1; #else - return false; + return 0; #endif } else if (ce->type == ZEND_USER_CLASS) { if (ce->ce_flags & ZEND_ACC_PRELOADED) { - return false; + return 0; } if (ce->info.user.filename == called_from->filename) { if (ce->parent && (!(ce->ce_flags & ZEND_ACC_LINKED) || zend_jit_class_may_be_modified(ce->parent, called_from))) { - return true; + return 1; } if (ce->num_interfaces) { if (!(ce->ce_flags & ZEND_ACC_LINKED)) { - return true; + return 1; } for (i = 0; i < ce->num_interfaces; i++) { if (zend_jit_class_may_be_modified(ce->interfaces[i], called_from)) { - return true; + return 1; } } } if (ce->num_traits) { if (!(ce->ce_flags & ZEND_ACC_LINKED)) { - return true; + return 1; } for (i=0; i < ce->num_traits; i++) { zend_class_entry *trait = zend_fetch_class_by_name(ce->trait_names[i].name, ce->trait_names[i].lc_name, ZEND_FETCH_CLASS_TRAIT | ZEND_FETCH_CLASS_NO_AUTOLOAD | ZEND_FETCH_CLASS_SILENT); if (!trait || zend_jit_class_may_be_modified(trait, called_from)) { - return true; + return 1; } } } - return false; + return 0; } } - return true; + return 1; } static bool zend_jit_may_be_modified(const zend_function *func, const zend_op_array *called_from) @@ -759,21 +759,21 @@ static bool zend_jit_may_be_modified(const zend_function *func, const zend_op_ar if (func->type == ZEND_INTERNAL_FUNCTION) { #ifdef _WIN32 /* ASLR */ - return true; + return 1; #else - return false; + return 0; #endif } else if (func->type == ZEND_USER_FUNCTION) { if (func->common.fn_flags & ZEND_ACC_PRELOADED) { - return false; + return 0; } if (func->op_array.filename == called_from->filename && (!func->op_array.scope || !zend_jit_class_may_be_modified(func->op_array.scope, called_from))) { - return false; + return 0; } } - return true; + return 1; } #define OP_RANGE(ssa_op, opN) \ @@ -1388,9 +1388,9 @@ static bool zend_jit_next_is_send_result(const zend_op *opline) && (opline+1)->op1_type == IS_TMP_VAR && (opline+1)->op2_type != IS_CONST && (opline+1)->op1.var == opline->result.var) { - return true; + return 1; } - return false; + return 0; } static bool zend_jit_supported_binary_op(uint8_t op, uint32_t op1_info, uint32_t op2_info)