Skip to content

Commit 6666cc8

Browse files
dstogoviluuu1994
authored andcommitted
Fix RC inference of op1 of FETCH_OBJ and INIT_METHOD_CALL
Fixes GH-17151 Closes GH-17152
1 parent cbe9d67 commit 6666cc8

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ PHP NEWS
5151
. opcache_get_configuration() properly reports jit_prof_threshold. (cmb)
5252
. Fixed bug GH-17140 (Assertion failure in JIT trace exit with
5353
ZEND_FETCH_DIM_FUNC_ARG). (nielsdos, Dmitry)
54+
. Fixed bug GH-17151 (Incorrect RC inference of op1 of FETCH_OBJ and
55+
INIT_METHOD_CALL). (Dmitry, ilutov)
5456

5557
- PCNTL:
5658
. Fix memory leak in cleanup code of pcntl_exec() when a non stringable

Zend/Optimizer/zend_inference.c

+4
Original file line numberDiff line numberDiff line change
@@ -1968,6 +1968,10 @@ static uint32_t get_ssa_alias_types(zend_ssa_alias_kind alias) {
19681968
/* TODO: support for array keys and ($str . "")*/ \
19691969
__type |= MAY_BE_RCN; \
19701970
} \
1971+
if ((__type & MAY_BE_RC1) && (__type & MAY_BE_OBJECT)) {\
1972+
/* TODO: object may be captured by magic handlers */\
1973+
__type |= MAY_BE_RCN; \
1974+
} \
19711975
if (__ssa_var->alias) { \
19721976
__type |= get_ssa_alias_types(__ssa_var->alias); \
19731977
} \

ext/opcache/jit/zend_jit_ir.c

+1
Original file line numberDiff line numberDiff line change
@@ -14426,6 +14426,7 @@ static int zend_jit_fetch_obj(zend_jit_ctx *jit,
1442614426
ir_MERGE_list(slow_inputs);
1442714427
jit_SET_EX_OPLINE(jit, opline);
1442814428

14429+
op1_info |= MAY_BE_RC1 | MAY_BE_RCN; /* object may be captured/released in magic handler */
1442914430
if (opline->opcode == ZEND_FETCH_OBJ_W) {
1443014431
ir_CALL_1(IR_VOID, ir_CONST_FC_FUNC(zend_jit_fetch_obj_w_slow), obj_ref);
1443114432
ir_END_list(end_inputs);

0 commit comments

Comments
 (0)