Merge branch 'PHP-8.0' into PHP-8.1

* PHP-8.0:
  JIT: Fixed NaN handling
This commit is contained in:
Dmitry Stogov 2021-09-28 23:55:28 +03:00
commit c08ee7c760
3 changed files with 28 additions and 4 deletions

View File

@ -8076,8 +8076,9 @@ static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, uint32_
| SET_ZVAL_TYPE_INFO res_addr, IS_FALSE, TMP1w, TMP2
} else {
| SET_ZVAL_TYPE_INFO res_addr, IS_FALSE, TMP1w, TMP2
| bvs &exit_addr
| bvs >1
| beq &exit_addr
|1:
| SET_ZVAL_TYPE_INFO res_addr, IS_TRUE, TMP1w, TMP2
}
} else if (false_label != (uint32_t)-1) { // JMPZ_EX
@ -8116,8 +8117,9 @@ static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, uint32_
| bne &exit_addr
|1:
} else {
| bvs &exit_addr
| bvs >1
| beq &exit_addr
|1:
}
} else {
ZEND_ASSERT(true_label != (uint32_t)-1 || false_label != (uint32_t)-1);

View File

@ -8637,8 +8637,9 @@ static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, uint32_
| SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
} else {
| SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
| jp &exit_addr
| jp >1
| je &exit_addr
|1:
| SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
}
} else if (false_label != (uint32_t)-1) { // JMPZ_EX
@ -8677,8 +8678,9 @@ static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, uint32_
| jne &exit_addr
|1:
} else {
| jp &exit_addr
| jp >1
| je &exit_addr
|1:
}
} else {
ZEND_ASSERT(true_label != (uint32_t)-1 || false_label != (uint32_t)-1);

View File

@ -0,0 +1,20 @@
--TEST--
NaN handling: 001
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
opcache.protect_memory=1
--FILE--
<?php
$b = NAN;
for ($i = 0; $i < 3; $i++) {
if ($b) { echo "nan is true\n"; }
else { echo "nan is false\n"; }
}
?>
--EXPECT--
nan is true
nan is true
nan is true