mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Disable type narrowing optimization when we contruct SSA for JIT
This commit is contained in:
commit
c6e895aec2
3 changed files with 9 additions and 4 deletions
|
@ -3968,7 +3968,7 @@ static bool can_convert_to_double(
|
|||
for (phi = var->phi_use_chain; phi; phi = zend_ssa_next_use_phi(ssa, var_num, phi)) {
|
||||
/* Check that narrowing can actually be useful */
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -4315,8 +4315,10 @@ static int zend_infer_types(const zend_op_array *op_array, const zend_script *sc
|
|||
return FAILURE;
|
||||
}
|
||||
|
||||
/* Narrowing integer initialization to doubles */
|
||||
zend_type_narrowing(op_array, script, ssa, optimization_level);
|
||||
if (optimization_level & ZEND_OPTIMIZER_NARROW_TO_DOUBLE) {
|
||||
/* Narrowing integer initialization to doubles */
|
||||
zend_type_narrowing(op_array, script, ssa, optimization_level);
|
||||
}
|
||||
|
||||
if (ZEND_FUNC_INFO(op_array)) {
|
||||
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_NARROW_TO_DOUBLE (1<<17) /* try to narrow long constant assignments to double */
|
||||
|
||||
#define ZEND_OPTIMIZER_ALL_PASSES 0x7FFFFFFF
|
||||
|
||||
#define DEFAULT_OPTIMIZATION_LEVEL "0x7FFEBFFF"
|
||||
|
|
|
@ -1346,7 +1346,8 @@ static int zend_jit_op_array_analyze2(const zend_op_array *op_array, zend_script
|
|||
&& op_array->last_try_catch == 0
|
||||
&& !(op_array->fn_flags & ZEND_ACC_GENERATOR)
|
||||
&& !(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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue