@@ -7942,7 +7942,7 @@ static int zend_jit_identical(dasm_State **Dst,
7942
7942
if (opline->op1_type != IS_CONST) {
7943
7943
| LOAD_ZVAL_ADDR FCARG1a, op1_addr
7944
7944
}
7945
- } else {
7945
+ } else if ((op1_info & op2_info & MAY_BE_ANY) != 0) {
7946
7946
if (opline->op1_type != IS_CONST) {
7947
7947
if (Z_MODE(op1_addr) == IS_REG) {
7948
7948
zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op1.var);
@@ -7964,12 +7964,6 @@ static int zend_jit_identical(dasm_State **Dst,
7964
7964
| LOAD_ZVAL_ADDR FCARG2a, op2_addr
7965
7965
}
7966
7966
}
7967
- if (opline->op1_type & (IS_CV|IS_VAR)) {
7968
- | ZVAL_DEREF FCARG1a, op1_info
7969
- }
7970
- if (opline->op2_type & (IS_CV|IS_VAR)) {
7971
- | ZVAL_DEREF FCARG2a, op2_info
7972
- }
7973
7967
7974
7968
if ((op1_info & op2_info & MAY_BE_ANY) == 0) {
7975
7969
if ((opline->opcode != ZEND_CASE_STRICT &&
@@ -7984,7 +7978,9 @@ static int zend_jit_identical(dasm_State **Dst,
7984
7978
| FREE_OP opline->op2_type, opline->op2, op2_info, 1, opline
7985
7979
}
7986
7980
if (smart_branch_opcode) {
7987
- zend_jit_check_exception_undef_result(Dst, opline);
7981
+ if (may_throw) {
7982
+ zend_jit_check_exception_undef_result(Dst, opline);
7983
+ }
7988
7984
if (exit_addr) {
7989
7985
if (smart_branch_opcode == ZEND_JMPZ) {
7990
7986
| jmp &exit_addr
@@ -7994,12 +7990,24 @@ static int zend_jit_identical(dasm_State **Dst,
7994
7990
}
7995
7991
} else {
7996
7992
| SET_ZVAL_TYPE_INFO res_addr, (opline->opcode != ZEND_IS_NOT_IDENTICAL ? IS_FALSE : IS_TRUE)
7997
- zend_jit_check_exception(Dst);
7993
+ if (may_throw) {
7994
+ zend_jit_check_exception(Dst);
7995
+ }
7998
7996
}
7999
- } else if (has_concrete_type(op1_info) &&
8000
- has_concrete_type(op2_info) &&
8001
- concrete_type(op1_info) == concrete_type(op2_info) &&
8002
- concrete_type(op1_info) <= IS_TRUE) {
7997
+ return 1;
7998
+ }
7999
+
8000
+ if (opline->op1_type & (IS_CV|IS_VAR)) {
8001
+ | ZVAL_DEREF FCARG1a, op1_info
8002
+ }
8003
+ if (opline->op2_type & (IS_CV|IS_VAR)) {
8004
+ | ZVAL_DEREF FCARG2a, op2_info
8005
+ }
8006
+
8007
+ if (has_concrete_type(op1_info)
8008
+ && has_concrete_type(op2_info)
8009
+ && concrete_type(op1_info) == concrete_type(op2_info)
8010
+ && concrete_type(op1_info) <= IS_TRUE) {
8003
8011
if (smart_branch_opcode) {
8004
8012
if (exit_addr) {
8005
8013
if (smart_branch_opcode == ZEND_JMPNZ) {
@@ -8046,7 +8054,9 @@ static int zend_jit_identical(dasm_State **Dst,
8046
8054
| jne >8
8047
8055
| SET_EX_OPLINE opline, r0
8048
8056
| FREE_OP opline->op2_type, opline->op2, op2_info, 1, opline
8049
- zend_jit_check_exception_undef_result(Dst, opline);
8057
+ if (may_throw) {
8058
+ zend_jit_check_exception_undef_result(Dst, opline);
8059
+ }
8050
8060
if (exit_addr && smart_branch_opcode == ZEND_JMPNZ) {
8051
8061
| jmp &exit_addr
8052
8062
} else if (identical_label != (uint32_t)-1) {
@@ -8076,7 +8086,9 @@ static int zend_jit_identical(dasm_State **Dst,
8076
8086
(op2_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) {
8077
8087
| SET_EX_OPLINE opline, r0
8078
8088
| FREE_OP opline->op2_type, opline->op2, op2_info, 1, opline
8079
- zend_jit_check_exception_undef_result(Dst, opline);
8089
+ if (may_throw) {
8090
+ zend_jit_check_exception_undef_result(Dst, opline);
8091
+ }
8080
8092
}
8081
8093
if (exit_addr) {
8082
8094
if (smart_branch_opcode == ZEND_JMPZ) {
@@ -8095,7 +8107,9 @@ static int zend_jit_identical(dasm_State **Dst,
8095
8107
| jne >8
8096
8108
| SET_EX_OPLINE opline, r0
8097
8109
| FREE_OP opline->op1_type, opline->op1, op1_info, 1, opline
8098
- zend_jit_check_exception_undef_result(Dst, opline);
8110
+ if (may_throw) {
8111
+ zend_jit_check_exception_undef_result(Dst, opline);
8112
+ }
8099
8113
if (exit_addr && smart_branch_opcode == ZEND_JMPNZ) {
8100
8114
| jmp &exit_addr
8101
8115
} else if (identical_label != (uint32_t)-1) {
@@ -8126,7 +8140,9 @@ static int zend_jit_identical(dasm_State **Dst,
8126
8140
(op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) {
8127
8141
| SET_EX_OPLINE opline, r0
8128
8142
| FREE_OP opline->op1_type, opline->op1, op1_info, 1, opline
8129
- zend_jit_check_exception_undef_result(Dst, opline);
8143
+ if (may_throw) {
8144
+ zend_jit_check_exception_undef_result(Dst, opline);
8145
+ }
8130
8146
}
8131
8147
if (smart_branch_opcode) {
8132
8148
if (exit_addr) {
@@ -8156,7 +8172,9 @@ static int zend_jit_identical(dasm_State **Dst,
8156
8172
| FREE_OP opline->op1_type, opline->op1, op1_info, 1, opline
8157
8173
}
8158
8174
| FREE_OP opline->op2_type, opline->op2, op2_info, 1, opline
8159
- zend_jit_check_exception_undef_result(Dst, opline);
8175
+ if (may_throw) {
8176
+ zend_jit_check_exception_undef_result(Dst, opline);
8177
+ }
8160
8178
| mov r0, aword T1 // restore
8161
8179
}
8162
8180
if (smart_branch_opcode) {
0 commit comments