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

Merge branch 'PHP-8.0' into PHP-8.1

* PHP-8.0:
  JIT: Fixed missed zval type initialization
This commit is contained in:
Dmitry Stogov
2021-09-27 20:15:51 +03:00
3 changed files with 48 additions and 1 deletions

View File

@@ -12748,15 +12748,19 @@ static int zend_jit_incdec_obj(dasm_State **Dst,
uint64_t val = 0x43e0000000000000;
| LOAD_64BIT_VAL REG0, val
| SET_ZVAL_LVAL_FROM_REG var_addr, REG0, TMP1
| SET_ZVAL_TYPE_INFO var_addr, IS_DOUBLE, TMP1w, TMP2
if (opline->opcode == ZEND_PRE_INC_OBJ && opline->result_type != IS_UNUSED) {
| SET_ZVAL_LVAL_FROM_REG res_addr, REG0, TMP1
| SET_ZVAL_TYPE_INFO res_addr, IS_DOUBLE, TMP1w, TMP2
}
} else {
uint64_t val = 0xc3e0000000000000;
| LOAD_64BIT_VAL REG0, val
| SET_ZVAL_LVAL_FROM_REG var_addr, REG0, TMP1
| SET_ZVAL_TYPE_INFO var_addr, IS_DOUBLE, TMP1w, TMP2
if (opline->opcode == ZEND_PRE_DEC_OBJ && opline->result_type != IS_UNUSED) {
| SET_ZVAL_LVAL_FROM_REG res_addr, REG0, TMP1
| SET_ZVAL_TYPE_INFO res_addr, IS_DOUBLE, TMP1w, TMP2
}
}
| b >4

View File

@@ -13456,31 +13456,39 @@ static int zend_jit_incdec_obj(dasm_State **Dst,
|.if X64
| mov64 rax, 0x43e0000000000000
| SET_ZVAL_LVAL var_addr, rax
| SET_ZVAL_TYPE_INFO var_addr, IS_DOUBLE
if (opline->opcode == ZEND_PRE_INC_OBJ && opline->result_type != IS_UNUSED) {
| SET_ZVAL_LVAL res_addr, rax
| SET_ZVAL_TYPE_INFO res_addr, IS_DOUBLE
}
|.else
| SET_ZVAL_LVAL var_addr, 0
| SET_ZVAL_W2 var_addr, 0x41e00000
| SET_ZVAL_TYPE_INFO var_addr, IS_DOUBLE
if (opline->opcode == ZEND_PRE_INC_OBJ && opline->result_type != IS_UNUSED) {
| SET_ZVAL_LVAL res_addr, 0
| SET_ZVAL_W2 res_addr, 0x41e00000
| SET_ZVAL_TYPE_INFO res_addr, IS_DOUBLE
}
|.endif
} else {
|.if X64
| mov64 rax, 0xc3e0000000000000
| SET_ZVAL_LVAL var_addr, rax
| SET_ZVAL_TYPE_INFO var_addr, IS_DOUBLE
if (opline->opcode == ZEND_PRE_DEC_OBJ && opline->result_type != IS_UNUSED) {
| SET_ZVAL_LVAL res_addr, rax
| SET_ZVAL_TYPE_INFO res_addr, IS_DOUBLE
}
|.else
| SET_ZVAL_LVAL var_addr, 0x00200000
| SET_ZVAL_W2 var_addr, 0xc1e00000
| SET_ZVAL_TYPE_INFO var_addr, IS_DOUBLE
if (opline->opcode == ZEND_PRE_DEC_OBJ && opline->result_type != IS_UNUSED) {
| SET_ZVAL_LVAL res_addr, 0x00200000
| SET_ZVAL_W2 res_addr, 0xc1e00000
}
| SET_ZVAL_TYPE_INFO res_addr, IS_DOUBLE
}
|.endif
}
| jmp >4

View File

@@ -0,0 +1,35 @@
--TEST--
PRE_INC_OBJ: 001
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
opcache.protect_memory=1
opcache.jit=function
--FILE--
<?php
class Test {
public $prop;
function foo() {
$this->prop = PHP_INT_MAX - 5;
for ($i = 0; $i < 10; $i++) {
var_dump(++$this->prop);
}
}
}
$test = new Test;
$test->foo();
?>
--EXPECTF--
int(%d)
int(%d)
int(%d)
int(%d)
int(%d)
float(%f)
float(%f)
float(%f)
float(%f)
float(%f)