Skip to content

Commit

Permalink
Fix RC inference of op1 of FETCH_OBJ and INIT_METHOD_CALL
Browse files Browse the repository at this point in the history
Fixes GH-17151
Closes GH-17152
  • Loading branch information
dstogov authored and iluuu1994 committed Dec 18, 2024
1 parent cbe9d67 commit 6666cc8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ PHP NEWS
. opcache_get_configuration() properly reports jit_prof_threshold. (cmb)
. Fixed bug GH-17140 (Assertion failure in JIT trace exit with
ZEND_FETCH_DIM_FUNC_ARG). (nielsdos, Dmitry)
. Fixed bug GH-17151 (Incorrect RC inference of op1 of FETCH_OBJ and
INIT_METHOD_CALL). (Dmitry, ilutov)

- PCNTL:
. Fix memory leak in cleanup code of pcntl_exec() when a non stringable
Expand Down
4 changes: 4 additions & 0 deletions Zend/Optimizer/zend_inference.c
Original file line number Diff line number Diff line change
Expand Up @@ -1968,6 +1968,10 @@ static uint32_t get_ssa_alias_types(zend_ssa_alias_kind alias) {
/* TODO: support for array keys and ($str . "")*/ \
__type |= MAY_BE_RCN; \
} \
if ((__type & MAY_BE_RC1) && (__type & MAY_BE_OBJECT)) {\
/* TODO: object may be captured by magic handlers */\
__type |= MAY_BE_RCN; \
} \
if (__ssa_var->alias) { \
__type |= get_ssa_alias_types(__ssa_var->alias); \
} \
Expand Down
1 change: 1 addition & 0 deletions ext/opcache/jit/zend_jit_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -14426,6 +14426,7 @@ static int zend_jit_fetch_obj(zend_jit_ctx *jit,
ir_MERGE_list(slow_inputs);
jit_SET_EX_OPLINE(jit, opline);

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

0 comments on commit 6666cc8

Please sign in to comment.