@@ -7744,8 +7744,13 @@ static zend_jit_addr zend_jit_guard_fetch_result_type(zend_jit_ctx *jit,
7744
7744
SET_STACK_TYPE(stack, EX_VAR_TO_NUM(opline->result.var), IS_UNKNOWN, 1);
7745
7745
7746
7746
if (deref) {
7747
- ir_ref if_type = jit_if_Z_TYPE(jit, val_addr, type) ;
7747
+ ir_ref if_type;
7748
7748
7749
+ if (type == IS_NULL && (opline->opcode == ZEND_FETCH_DIM_IS || opline->opcode == ZEND_FETCH_OBJ_IS)) {
7750
+ if_type = ir_IF(ir_ULE(jit_Z_TYPE(jit, val_addr), ir_CONST_U8(type)));
7751
+ } else {
7752
+ if_type = jit_if_Z_TYPE(jit, val_addr, type);
7753
+ }
7749
7754
ir_IF_TRUE(if_type);
7750
7755
end1 = ir_END();
7751
7756
ref1 = ref;
@@ -7770,7 +7775,11 @@ static zend_jit_addr zend_jit_guard_fetch_result_type(zend_jit_ctx *jit,
7770
7775
return 0;
7771
7776
}
7772
7777
7773
- jit_guard_Z_TYPE(jit, val_addr, type, res_exit_addr);
7778
+ if (!deref && type == IS_NULL && (opline->opcode == ZEND_FETCH_DIM_IS || opline->opcode == ZEND_FETCH_OBJ_IS)) {
7779
+ ir_GUARD(ir_ULE(jit_Z_TYPE(jit, val_addr), ir_CONST_U8(type)), ir_CONST_ADDR(res_exit_addr));
7780
+ } else {
7781
+ jit_guard_Z_TYPE(jit, val_addr, type, res_exit_addr);
7782
+ }
7774
7783
7775
7784
if (deref) {
7776
7785
ir_MERGE_WITH(end1);
@@ -11576,39 +11585,20 @@ static int zend_jit_fetch_dimension_address_inner(zend_jit_ctx *jit,
11576
11585
if (packed_loaded) {
11577
11586
ir_ref type_ref = jit_Z_TYPE_ref(jit, ref);
11578
11587
11579
- if (op1_info & MAY_BE_ARRAY_NUMERIC_HASH) {
11580
- ir_ref if_def = ir_IF(type_ref);
11581
- ir_IF_TRUE(if_def);
11582
- ir_refs_add(found_inputs, ir_END());
11583
- ir_refs_add(found_vals, ref);
11584
- ir_IF_FALSE(if_def);
11585
- if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE && type == BP_VAR_R) {
11586
- jit_SIDE_EXIT(jit, ir_CONST_ADDR(exit_addr));
11587
- } else if (type == BP_VAR_IS && not_found_exit_addr) {
11588
- jit_SIDE_EXIT(jit, ir_CONST_ADDR(not_found_exit_addr));
11589
- } else if (type == BP_VAR_IS && result_type_guard) {
11590
- ir_END_list(*not_found_inputs);
11591
- } else {
11592
- ir_END_list(idx_not_found_inputs);
11593
- }
11594
- } else if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE && type == BP_VAR_R) {
11588
+ if (result_type_guard) {
11595
11589
/* perform IS_UNDEF check only after result type guard (during deoptimization) */
11596
- if (!result_type_guard) {
11597
- ir_GUARD(type_ref, ir_CONST_ADDR(exit_addr));
11598
- }
11590
+ } else if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE && type == BP_VAR_R) {
11591
+ ir_GUARD(type_ref, ir_CONST_ADDR(exit_addr));
11599
11592
} else if (type == BP_VAR_IS && not_found_exit_addr) {
11600
11593
ir_GUARD(type_ref, ir_CONST_ADDR(not_found_exit_addr));
11601
- } else if (type == BP_VAR_IS && result_type_guard) {
11602
- ir_ref if_def = ir_IF(type_ref);
11603
- ir_IF_FALSE(if_def);
11604
- ir_END_list(*not_found_inputs);
11605
- ir_IF_TRUE(if_def);
11606
11594
} else {
11607
11595
ir_ref if_def = ir_IF(type_ref);
11608
11596
ir_IF_FALSE(if_def);
11609
11597
ir_END_list(idx_not_found_inputs);
11610
11598
ir_IF_TRUE(if_def);
11611
11599
}
11600
+ ir_refs_add(found_inputs, ir_END());
11601
+ ir_refs_add(found_vals, ref);
11612
11602
}
11613
11603
if (op1_info & MAY_BE_ARRAY_NUMERIC_HASH) {
11614
11604
if (if_packed) {
@@ -11641,10 +11631,7 @@ static int zend_jit_fetch_dimension_address_inner(zend_jit_ctx *jit,
11641
11631
}
11642
11632
ir_refs_add(found_inputs, ir_END());
11643
11633
ir_refs_add(found_vals, ref);
11644
- } else if (packed_loaded) {
11645
- ir_refs_add(found_inputs, ir_END());
11646
- ir_refs_add(found_vals, ref);
11647
- } else {
11634
+ } else if (!packed_loaded) {
11648
11635
if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE && type == BP_VAR_R) {
11649
11636
jit_SIDE_EXIT(jit, ir_CONST_ADDR(exit_addr));
11650
11637
} else if (type == BP_VAR_IS && not_found_exit_addr) {
0 commit comments