Skip to content

Commit 8f3e555

Browse files
authored
Use zval_try_get_string_func() in concat_function() (#18815)
This allows a cheaper exception check and also does not need a release call. This shrinks concat_function() on x86-64 with GCC 15.1.1 from 3443 bytes to 3332 bytes.
1 parent 5f9a0b5 commit 8f3e555

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Zend/zend_operators.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,9 +1989,8 @@ ZEND_API zend_result ZEND_FASTCALL concat_function(zval *result, zval *op1, zval
19891989
}
19901990
}
19911991
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_CONCAT);
1992-
op1_string = zval_get_string_func(op1);
1993-
if (UNEXPECTED(EG(exception))) {
1994-
zend_string_release(op1_string);
1992+
op1_string = zval_try_get_string_func(op1);
1993+
if (UNEXPECTED(!op1_string)) {
19951994
if (orig_op1 != result) {
19961995
ZVAL_UNDEF(result);
19971996
}
@@ -2023,10 +2022,9 @@ ZEND_API zend_result ZEND_FASTCALL concat_function(zval *result, zval *op1, zval
20232022
free_op1_string = true;
20242023
}
20252024
ZEND_TRY_BINARY_OP2_OBJECT_OPERATION(ZEND_CONCAT);
2026-
op2_string = zval_get_string_func(op2);
2027-
if (UNEXPECTED(EG(exception))) {
2025+
op2_string = zval_try_get_string_func(op2);
2026+
if (UNEXPECTED(!op2_string)) {
20282027
zend_string_release(op1_string);
2029-
zend_string_release(op2_string);
20302028
if (orig_op1 != result) {
20312029
ZVAL_UNDEF(result);
20322030
}

0 commit comments

Comments
 (0)