Skip to content

Commit 3f42ce1

Browse files
committed
Added few more instructions without side effects and exceptions
1 parent b17178f commit 3f42ce1

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

ext/opcache/Optimizer/dce.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,15 @@ static inline zend_bool may_have_side_effects(
108108
case ZEND_ROPE_END:
109109
case ZEND_INIT_ARRAY:
110110
case ZEND_ADD_ARRAY_ELEMENT:
111+
case ZEND_SPACESHIP:
112+
case ZEND_STRLEN:
113+
case ZEND_COUNT:
114+
case ZEND_GET_TYPE:
115+
case ZEND_ISSET_ISEMPTY_THIS:
116+
case ZEND_ISSET_ISEMPTY_DIM_OBJ:
117+
case ZEND_FETCH_DIM_IS:
118+
case ZEND_ISSET_ISEMPTY_VAR:
119+
case ZEND_FETCH_IS:
111120
/* No side effects */
112121
return 0;
113122
case ZEND_JMP:

ext/opcache/Optimizer/zend_inference.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4172,6 +4172,8 @@ int zend_may_throw(const zend_op *opline, zend_op_array *op_array, zend_ssa *ssa
41724172
return (opline->op2_type != IS_UNUSED) && (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE));
41734173
case ZEND_STRLEN:
41744174
return (t1 & MAY_BE_ANY) != MAY_BE_STRING;
4175+
case ZEND_COUNT:
4176+
return (t1 & MAY_BE_ANY) != MAY_BE_ARRAY;
41754177
case ZEND_RECV_INIT:
41764178
if (Z_CONSTANT_P(CRT_CONSTANT_EX(op_array, opline->op2, ssa->rt_constants))) {
41774179
return 1;
@@ -4191,6 +4193,8 @@ int zend_may_throw(const zend_op *opline, zend_op_array *op_array, zend_ssa *ssa
41914193
} else {
41924194
return 0;
41934195
}
4196+
case ZEND_FETCH_IS:
4197+
return (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT));
41944198
case ZEND_ISSET_ISEMPTY_DIM_OBJ:
41954199
case ZEND_FETCH_DIM_IS:
41964200
return (t1 & MAY_BE_OBJECT) || (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT));

0 commit comments

Comments
 (0)