com php-src: Fixed memory leak in Zend/tests/bug78999.phpt: ext/opcache/jit/zend_jit_trace.c ext/opcache/jit/zend _jit_x86.dasc
| From: | Dmitry Stogov | Date: | Wed, 28 Oct 2020 07:47:23 +0000 |
| Subject: | com php-src: Fixed memory leak in Zend/tests/bug78999.phpt: ext/opcache/jit/zend_jit_trace.c ext/opcache/jit/zend _jit_x86.dasc | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-113953@lists.php.net to get a copy of this message | ||
Commit: 47a56208f0902ecb95d879197a7ed9a3ca9a7e61
Author: Dmitry Stogov <dmitry@zend.com> Wed, 28 Oct 2020 10:47:23 +0300
Parents: e6b51ccc58002a4cc3dd2eee22f1c03425480278
Branches: PHP-8.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=47a56208f0902ecb95d879197a7ed9a3ca9a7e61
Log:
Fixed memory leak in Zend/tests/bug78999.phpt
Bugs:
https://bugs.php.net/78999
Changed paths:
M ext/opcache/jit/zend_jit_trace.c
M ext/opcache/jit/zend_jit_x86.dasc
Diff:
diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c
index a559b6fa290..45d9e4cd71d 100644
--- a/ext/opcache/jit/zend_jit_trace.c
+++ b/ext/opcache/jit/zend_jit_trace.c
@@ -4623,11 +4623,11 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t
par
info = zend_jit_trace_type_to_info_ex(type, info);
if (opline->op1_type == IS_CV
&& EX_VAR_TO_NUM(opline->op1.var) == j
- && !(op1_info & MAY_BE_REF)
- && JIT_G(current_frame)) {
- if (TRACE_FRAME_IS_RETURN_VALUE_USED(JIT_G(current_frame))) {
+ && !(op1_info & (MAY_BE_REF|MAY_BE_OBJECT))) {
+ if (JIT_G(current_frame)
+ && TRACE_FRAME_IS_RETURN_VALUE_USED(JIT_G(current_frame))) {
continue;
- } else if ((op1_info & (MAY_BE_ANY|MAY_BE_UNDEF)) != MAY_BE_OBJECT) {
+ } else {
info |= MAY_BE_NULL;
}
}
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index d2d5f7eaf5e..312c8587926 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -11361,17 +11361,14 @@ static int zend_jit_return(dasm_State **Dst, const zend_op *opline, const
zend_o
op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R0, 0);
}
| ZVAL_COPY_VALUE ret_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R0, ZREG_R2
- if (JIT_G(trigger) != ZEND_JIT_ON_HOT_TRACE || (op1_info & MAY_BE_REF) || (return_value_used
!= 1)) {
- if (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
- if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE
- && !(op1_info & MAY_BE_REF)
- && op_array->function_name
- && (op1_info & (MAY_BE_ANY|MAY_BE_UNDEF)) != MAY_BE_OBJECT) {
- | // if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) ZVAL_NULL(retval_ptr);
- | SET_ZVAL_TYPE_INFO op1_addr, IS_NULL
- } else {
- | TRY_ADDREF op1_info, ah, r2
- }
+ if (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
+ if (JIT_G(trigger) != ZEND_JIT_ON_HOT_TRACE ||
+ (op1_info & (MAY_BE_REF|MAY_BE_OBJECT)) ||
+ !op_array->function_name) {
+ | TRY_ADDREF op1_info, ah, r2
+ } else if (return_value_used != 1) {
+ | // if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) ZVAL_NULL(retval_ptr);
+ | SET_ZVAL_TYPE_INFO op1_addr, IS_NULL
}
}
} else {