Skip to content

Commit d66f9f5

Browse files
committed
Small optimization
1 parent a590953 commit d66f9f5

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

ext/opcache/jit/zend_jit.c

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,11 +2335,6 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
23352335
case ZEND_FETCH_OBJ_R:
23362336
case ZEND_FETCH_OBJ_IS:
23372337
case ZEND_FETCH_OBJ_W:
2338-
if (opline->op2_type != IS_CONST
2339-
|| Z_TYPE_P(RT_CONSTANT(opline, opline->op2)) != IS_STRING
2340-
|| Z_STRVAL_P(RT_CONSTANT(opline, opline->op2))[0] == '\0') {
2341-
break;
2342-
}
23432338
ce = NULL;
23442339
ce_is_instanceof = 0;
23452340
on_this = 0;
@@ -2369,6 +2364,11 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
23692364
}
23702365
}
23712366
}
2367+
if (opline->op2_type != IS_CONST
2368+
|| Z_TYPE_P(RT_CONSTANT(opline, opline->op2)) != IS_STRING
2369+
|| Z_STRVAL_P(RT_CONSTANT(opline, opline->op2))[0] == '\0') {
2370+
break;
2371+
}
23722372
if (!zend_jit_fetch_obj(&ctx, opline, op_array, ssa, ssa_op,
23732373
op1_info, op1_addr, 0, ce, ce_is_instanceof, on_this, 0, 0, NULL,
23742374
RES_REG_ADDR(), IS_UNKNOWN,
@@ -2716,15 +2716,25 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
27162716
goto jit_failure;
27172717
}
27182718

2719-
/* If a simple hook is called, exit to the VM. */
2720-
ir_ref if_hook_enter = ir_IF(jit_CMP_IP(jit, IR_EQ, opline + 1));
2721-
ir_IF_FALSE(if_hook_enter);
2722-
if (GCC_GLOBAL_REGS) {
2723-
ir_TAILCALL(IR_VOID, ir_LOAD_A(jit_IP(jit)));
2724-
} else {
2725-
ir_RETURN(ir_CONST_I32(1)); /* ZEND_VM_ENTER */
2719+
if (JIT_G(opt_level) < ZEND_JIT_LEVEL_INLINE) {
2720+
if (opline->op1_type == IS_UNUSED) {
2721+
ce = op_array->scope;
2722+
} else {
2723+
ce = NULL;
2724+
}
2725+
}
2726+
2727+
if (!ce || !(ce->ce_flags & ZEND_ACC_FINAL) || ce->num_hooked_props > 0) {
2728+
/* If a simple hook is called, exit to the VM. */
2729+
ir_ref if_hook_enter = ir_IF(jit_CMP_IP(jit, IR_EQ, opline + 1));
2730+
ir_IF_FALSE(if_hook_enter);
2731+
if (GCC_GLOBAL_REGS) {
2732+
ir_TAILCALL(IR_VOID, ir_LOAD_A(jit_IP(jit)));
2733+
} else {
2734+
ir_RETURN(ir_CONST_I32(1)); /* ZEND_VM_ENTER */
2735+
}
2736+
ir_IF_TRUE(if_hook_enter);
27262737
}
2727-
ir_IF_TRUE(if_hook_enter);
27282738

27292739
break;
27302740
default:

0 commit comments

Comments
 (0)