Skip to content

Commit 9d409f2

Browse files
committed
Eliminate ZSTR_IS_INTERNED() check
1 parent f956434 commit 9d409f2

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,15 +1103,21 @@ static void ZEND_FASTCALL zend_jit_fast_assign_concat_helper(zval *op1, zval *op
11031103
return;
11041104
}
11051105

1106-
if (Z_REFCOUNTED_P(op1)) {
1107-
result_str = zend_string_extend(Z_STR_P(op1), result_len, 0);
1108-
} else {
1106+
do {
1107+
if (Z_REFCOUNTED_P(op1)) {
1108+
if (GC_REFCOUNT(Z_STR_P(op1)) == 1) {
1109+
result_str = perealloc(Z_STR_P(op1), ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(result_len)), 0);
1110+
ZSTR_LEN(result_str) = result_len;
1111+
zend_string_forget_hash_val(result_str);
1112+
break;
1113+
}
1114+
GC_DELREF(Z_STR_P(op1));
1115+
}
11091116
result_str = zend_string_alloc(result_len, 0);
11101117
memcpy(ZSTR_VAL(result_str), Z_STRVAL_P(op1), op1_len);
1111-
}
1118+
} while(0);
11121119

11131120
ZVAL_NEW_STR(op1, result_str);
1114-
11151121
memcpy(ZSTR_VAL(result_str) + op1_len, Z_STRVAL_P(op2), op2_len);
11161122
ZSTR_VAL(result_str)[result_len] = '\0';
11171123
}

0 commit comments

Comments
 (0)