mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.1'
* PHP-8.1: Disable type narrowing optimization when we contruct SSA for JIT
This commit is contained in:
commit
ee38e3ac37
3 changed files with 9 additions and 4 deletions
|
@ -4010,7 +4010,7 @@ static bool can_convert_to_double(
|
||||||
for (phi = var->phi_use_chain; phi; phi = zend_ssa_next_use_phi(ssa, var_num, phi)) {
|
for (phi = var->phi_use_chain; phi; phi = zend_ssa_next_use_phi(ssa, var_num, phi)) {
|
||||||
/* Check that narrowing can actually be useful */
|
/* Check that narrowing can actually be useful */
|
||||||
type = ssa->var_info[phi->ssa_var].type;
|
type = ssa->var_info[phi->ssa_var].type;
|
||||||
if (type & ((MAY_BE_ANY|MAY_BE_UNDEF) - (MAY_BE_LONG|MAY_BE_DOUBLE))) {
|
if ((type & MAY_BE_ANY) & ~(MAY_BE_LONG|MAY_BE_DOUBLE)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4357,8 +4357,10 @@ static zend_result zend_infer_types(const zend_op_array *op_array, const zend_sc
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Narrowing integer initialization to doubles */
|
if (optimization_level & ZEND_OPTIMIZER_NARROW_TO_DOUBLE) {
|
||||||
zend_type_narrowing(op_array, script, ssa, optimization_level);
|
/* Narrowing integer initialization to doubles */
|
||||||
|
zend_type_narrowing(op_array, script, ssa, optimization_level);
|
||||||
|
}
|
||||||
|
|
||||||
if (ZEND_FUNC_INFO(op_array)) {
|
if (ZEND_FUNC_INFO(op_array)) {
|
||||||
zend_func_return_info(op_array, script, 1, 0, &ZEND_FUNC_INFO(op_array)->return_info);
|
zend_func_return_info(op_array, script, 1, 0, &ZEND_FUNC_INFO(op_array)->return_info);
|
||||||
|
|
|
@ -44,6 +44,8 @@
|
||||||
|
|
||||||
#define ZEND_OPTIMIZER_IGNORE_OVERLOADING (1<<16) /* (unsafe) Ignore possibility of operator overloading */
|
#define ZEND_OPTIMIZER_IGNORE_OVERLOADING (1<<16) /* (unsafe) Ignore possibility of operator overloading */
|
||||||
|
|
||||||
|
#define ZEND_OPTIMIZER_NARROW_TO_DOUBLE (1<<17) /* try to narrow long constant assignments to double */
|
||||||
|
|
||||||
#define ZEND_OPTIMIZER_ALL_PASSES 0x7FFFFFFF
|
#define ZEND_OPTIMIZER_ALL_PASSES 0x7FFFFFFF
|
||||||
|
|
||||||
#define DEFAULT_OPTIMIZATION_LEVEL "0x7FFEBFFF"
|
#define DEFAULT_OPTIMIZATION_LEVEL "0x7FFEBFFF"
|
||||||
|
|
|
@ -1332,7 +1332,8 @@ static int zend_jit_op_array_analyze2(const zend_op_array *op_array, zend_script
|
||||||
&& op_array->last_try_catch == 0
|
&& op_array->last_try_catch == 0
|
||||||
&& !(op_array->fn_flags & ZEND_ACC_GENERATOR)
|
&& !(op_array->fn_flags & ZEND_ACC_GENERATOR)
|
||||||
&& !(ssa->cfg.flags & ZEND_FUNC_INDIRECT_VAR_ACCESS)) {
|
&& !(ssa->cfg.flags & ZEND_FUNC_INDIRECT_VAR_ACCESS)) {
|
||||||
if (zend_ssa_inference(&CG(arena), op_array, script, ssa, optimization_level) != SUCCESS) {
|
if (zend_ssa_inference(&CG(arena), op_array, script, ssa,
|
||||||
|
optimization_level & ~ZEND_OPTIMIZER_NARROW_TO_DOUBLE) != SUCCESS) {
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue