Skip to content

Commit 3564979

Browse files
committed
JIT: skip typed property write check when value type is proven
Signed-off-by: azjezz <azjezz@protonmail.com>
1 parent faa7adc commit 3564979

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

ext/opcache/jit/zend_jit_ir.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14897,6 +14897,11 @@ static int zend_jit_assign_obj(zend_jit_ctx *jit,
1489714897
}
1489814898
}
1489914899

14900+
/* The optimizer proved the assigned value already satisfies the (typed)
14901+
* property, so the run-time type check can be skipped (see dfa_pass.c). */
14902+
bool skip_type_check = prop_info
14903+
&& ((opline + 1)->extended_value & ZEND_ASSIGN_OBJ_SKIP_TYPE_CHECK);
14904+
1490014905
if (!prop_info) {
1490114906
ir_ref run_time_cache = ir_LOAD_A(jit_EX(run_time_cache));
1490214907
ir_ref ref = ir_LOAD_A(ir_ADD_OFFSET(run_time_cache, opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS));
@@ -14989,7 +14994,7 @@ static int zend_jit_assign_obj(zend_jit_ctx *jit,
1498914994
ir_END_list(slow_inputs);
1499014995
ir_IF_TRUE(if_def);
1499114996
}
14992-
if (ZEND_TYPE_IS_SET(prop_info->type)) {
14997+
if (ZEND_TYPE_IS_SET(prop_info->type) && !skip_type_check) {
1499314998
ir_ref ref, arg3, arg4;
1499414999

1499515000
// JIT: value = zend_assign_to_typed_prop(prop_info, property_val, value EXECUTE_DATA_CC);
@@ -15031,7 +15036,7 @@ static int zend_jit_assign_obj(zend_jit_ctx *jit,
1503115036
}
1503215037
}
1503315038

15034-
if (!prop_info || !ZEND_TYPE_IS_SET(prop_info->type)) {
15039+
if (!prop_info || !ZEND_TYPE_IS_SET(prop_info->type) || skip_type_check) {
1503515040
if (Z_MODE(val_addr) != IS_REG
1503615041
&& (res_addr == 0 || Z_MODE(res_addr) != IS_REG)
1503715042
&& opline->result_type == IS_UNUSED) {

0 commit comments

Comments
 (0)