diff options
author | Dmitry Stogov <dmitry@zend.com> | 2020-07-17 10:13:23 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2020-07-17 10:13:23 +0300 |
commit | e0af92c16e42bafe542f08268be73b807d550be0 (patch) | |
tree | 0f2e9cf6bfdd8a9442ac58fcf5fef538a31069cb | |
parent | a167e0426d7c10e242ddcf7bcd034a1ddf37cdf3 (diff) | |
download | php-git-e0af92c16e42bafe542f08268be73b807d550be0.tar.gz |
Eliminate useless exception checks
-rw-r--r-- | ext/opcache/Optimizer/zend_inference.c | 6 | ||||
-rw-r--r-- | ext/opcache/jit/zend_jit_trace.c | 2 | ||||
-rw-r--r-- | ext/opcache/jit/zend_jit_x86.dasc | 2 |
3 files changed, 7 insertions, 3 deletions
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index e0388a0b9c..8e885e378d 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -4312,7 +4312,8 @@ int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const ze } } } else if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) { - if (t1 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY)) { + if ((t1 & MAY_BE_RC1) + && (t1 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY))) { switch (opline->opcode) { case ZEND_CASE: case ZEND_CASE_STRICT: @@ -4350,7 +4351,8 @@ int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const ze } } } else if (opline->op2_type & (IS_TMP_VAR|IS_VAR)) { - if (t2 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY)) { + if ((t2 & MAY_BE_RC1) + && (t2 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY))) { switch (opline->opcode) { case ZEND_ASSIGN: break; diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c index 8fa1bca054..b73177ee58 100644 --- a/ext/opcache/jit/zend_jit_trace.c +++ b/ext/opcache/jit/zend_jit_trace.c @@ -3765,9 +3765,11 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par ((op1_info & MAY_BE_UNDEF) != 0 && opline->opcode == ZEND_FETCH_DIM_R) || ((opline->op1_type & (IS_TMP_VAR|IS_VAR)) != 0 && + (op1_info & MAY_BE_RC1) && (op1_info & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY)) != 0) || (op2_info & MAY_BE_UNDEF) != 0 || ((opline->op2_type & (IS_TMP_VAR|IS_VAR)) != 0 && + (op2_info & MAY_BE_RC1) && (op2_info & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY)) != 0)))) { goto jit_failure; } diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index 91cecf30e6..75f7131f80 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -10595,7 +10595,7 @@ static int zend_jit_isset_isempty_dim(dasm_State **Dst, const zend_op *opline, c if (exit_addr && !(op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_ARRAY)) && !may_throw - && !(opline->op1_type & (IS_TMP_VAR|IS_VAR)) + && (!(opline->op1_type & (IS_TMP_VAR|IS_VAR)) || (op1_info & AVOID_REFCOUNTING)) && (!(opline->op2_type & (IS_TMP_VAR|IS_VAR)) || !(op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG)))) { if (smart_branch_opcode == ZEND_JMPNZ) { found_exit_addr = exit_addr; |