mirror of
https://github.com/php/php-src.git
synced 2026-04-26 17:38:14 +02:00
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: JIT: Fixed memory leak
This commit is contained in:
@@ -4951,6 +4951,8 @@ static int zend_jit_concat_helper(dasm_State **Dst,
|
||||
}
|
||||
| LOAD_ZVAL_ADDR FCARG2x, op2_addr
|
||||
| EXT_CALL zend_jit_fast_assign_concat_helper, REG0
|
||||
/* concatination with itself may reduce refcount */
|
||||
op2_info |= MAY_BE_RC1;
|
||||
} else {
|
||||
if (Z_REG(res_addr) != ZREG_FCARG1 || Z_OFFSET(res_addr) != 0) {
|
||||
| LOAD_ZVAL_ADDR FCARG1x, res_addr
|
||||
|
||||
@@ -1162,7 +1162,7 @@ static void ZEND_FASTCALL zend_jit_fast_assign_concat_helper(zval *op1, zval *op
|
||||
|
||||
do {
|
||||
if (Z_REFCOUNTED_P(op1)) {
|
||||
if (GC_REFCOUNT(Z_STR_P(op1)) == 1) {
|
||||
if (GC_REFCOUNT(Z_STR_P(op1)) == 1 && EXPECTED(Z_STR_P(op1) != Z_STR_P(op2))) {
|
||||
result_str = perealloc(Z_STR_P(op1), ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(result_len)), 0);
|
||||
ZSTR_LEN(result_str) = result_len;
|
||||
zend_string_forget_hash_val(result_str);
|
||||
|
||||
@@ -5397,6 +5397,8 @@ static int zend_jit_concat_helper(dasm_State **Dst,
|
||||
}
|
||||
| LOAD_ZVAL_ADDR FCARG2a, op2_addr
|
||||
| EXT_CALL zend_jit_fast_assign_concat_helper, r0
|
||||
/* concatination with itself may reduce refcount */
|
||||
op2_info |= MAY_BE_RC1;
|
||||
} else {
|
||||
if (Z_REG(res_addr) != ZREG_FCARG1 || Z_OFFSET(res_addr) != 0) {
|
||||
| LOAD_ZVAL_ADDR FCARG1a, res_addr
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
JIT ASSIGN_OP: 006 concationation with itself
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_update_protection=0
|
||||
opcache.jit_buffer_size=1M
|
||||
--FILE--
|
||||
<?php
|
||||
function test($a) {
|
||||
for ($i = 0; $i < 2; $i++) {
|
||||
$a .= $a = $a;
|
||||
}
|
||||
}
|
||||
test("");
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
DONE
|
||||
Reference in New Issue
Block a user