Added few more instructions without side effects and exceptions

This commit is contained in:
Dmitry Stogov 2017-07-12 23:03:11 +03:00
parent b17178f991
commit 3f42ce18ba
2 changed files with 13 additions and 0 deletions

View file

@ -108,6 +108,15 @@ static inline zend_bool may_have_side_effects(
case ZEND_ROPE_END: case ZEND_ROPE_END:
case ZEND_INIT_ARRAY: case ZEND_INIT_ARRAY:
case ZEND_ADD_ARRAY_ELEMENT: case ZEND_ADD_ARRAY_ELEMENT:
case ZEND_SPACESHIP:
case ZEND_STRLEN:
case ZEND_COUNT:
case ZEND_GET_TYPE:
case ZEND_ISSET_ISEMPTY_THIS:
case ZEND_ISSET_ISEMPTY_DIM_OBJ:
case ZEND_FETCH_DIM_IS:
case ZEND_ISSET_ISEMPTY_VAR:
case ZEND_FETCH_IS:
/* No side effects */ /* No side effects */
return 0; return 0;
case ZEND_JMP: case ZEND_JMP:

View file

@ -4172,6 +4172,8 @@ int zend_may_throw(const zend_op *opline, zend_op_array *op_array, zend_ssa *ssa
return (opline->op2_type != IS_UNUSED) && (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); return (opline->op2_type != IS_UNUSED) && (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE));
case ZEND_STRLEN: case ZEND_STRLEN:
return (t1 & MAY_BE_ANY) != MAY_BE_STRING; return (t1 & MAY_BE_ANY) != MAY_BE_STRING;
case ZEND_COUNT:
return (t1 & MAY_BE_ANY) != MAY_BE_ARRAY;
case ZEND_RECV_INIT: case ZEND_RECV_INIT:
if (Z_CONSTANT_P(CRT_CONSTANT_EX(op_array, opline->op2, ssa->rt_constants))) { if (Z_CONSTANT_P(CRT_CONSTANT_EX(op_array, opline->op2, ssa->rt_constants))) {
return 1; return 1;
@ -4191,6 +4193,8 @@ int zend_may_throw(const zend_op *opline, zend_op_array *op_array, zend_ssa *ssa
} else { } else {
return 0; return 0;
} }
case ZEND_FETCH_IS:
return (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT));
case ZEND_ISSET_ISEMPTY_DIM_OBJ: case ZEND_ISSET_ISEMPTY_DIM_OBJ:
case ZEND_FETCH_DIM_IS: case ZEND_FETCH_DIM_IS:
return (t1 & MAY_BE_OBJECT) || (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT)); return (t1 & MAY_BE_OBJECT) || (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT));