Skip to content

Commit 8f342ad

Browse files
committed
JIT for PRE/POST_INC/DEC_OBJ
1 parent d0111d7 commit 8f342ad

File tree

5 files changed

+941
-0
lines changed

5 files changed

+941
-0
lines changed

ext/opcache/jit/zend_jit.c

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2457,6 +2457,49 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
24572457
goto jit_failure;
24582458
}
24592459
goto done;
2460+
case ZEND_PRE_INC_OBJ:
2461+
case ZEND_PRE_DEC_OBJ:
2462+
case ZEND_POST_INC_OBJ:
2463+
case ZEND_POST_DEC_OBJ:
2464+
if (opline->op2_type != IS_CONST
2465+
|| Z_TYPE_P(RT_CONSTANT(opline, opline->op2)) != IS_STRING
2466+
|| Z_STRVAL_P(RT_CONSTANT(opline, opline->op2))[0] == '\0') {
2467+
break;
2468+
}
2469+
if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
2470+
break;
2471+
}
2472+
ce = NULL;
2473+
ce_is_instanceof = 0;
2474+
if (opline->op1_type == IS_UNUSED) {
2475+
op1_info = MAY_BE_OBJECT|MAY_BE_RC1|MAY_BE_RCN;
2476+
ce = op_array->scope;
2477+
ce_is_instanceof = (ce->ce_flags & ZEND_ACC_FINAL) != 0;
2478+
op1_addr = 0;
2479+
} else {
2480+
op1_info = OP1_INFO();
2481+
if (!(op1_info & MAY_BE_OBJECT)) {
2482+
break;
2483+
}
2484+
op1_addr = OP1_REG_ADDR();
2485+
if (ssa->var_info && ssa->ops) {
2486+
zend_ssa_op *ssa_op = &ssa->ops[opline - op_array->opcodes];
2487+
if (ssa_op->op1_use >= 0) {
2488+
zend_ssa_var_info *op1_ssa = ssa->var_info + ssa_op->op1_use;
2489+
if (op1_ssa->ce && !op1_ssa->ce->create_object) {
2490+
ce = op1_ssa->ce;
2491+
ce_is_instanceof = op1_ssa->is_instanceof;
2492+
}
2493+
}
2494+
}
2495+
}
2496+
if (!zend_jit_incdec_obj(&dasm_state, opline, op_array, ssa, ssa_op,
2497+
op1_info, op1_addr,
2498+
0, ce, ce_is_instanceof, 0, NULL,
2499+
zend_may_throw(opline, ssa_op, op_array, ssa))) {
2500+
goto jit_failure;
2501+
}
2502+
goto done;
24602503
case ZEND_ASSIGN_OBJ_OP:
24612504
if (opline->extended_value == ZEND_POW
24622505
|| opline->extended_value == ZEND_DIV) {

ext/opcache/jit/zend_jit_disasm_x86.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ static int zend_jit_disasm_init(void)
456456
REGISTER_HELPER(zend_jit_invalid_array_access);
457457
REGISTER_HELPER(zend_jit_invalid_property_read);
458458
REGISTER_HELPER(zend_jit_invalid_property_write);
459+
REGISTER_HELPER(zend_jit_invalid_property_incdec);
459460
REGISTER_HELPER(zend_jit_invalid_property_assign);
460461
REGISTER_HELPER(zend_jit_invalid_property_assign_op);
461462
REGISTER_HELPER(zend_jit_prepare_assign_dim_ref);
@@ -472,6 +473,16 @@ static int zend_jit_disasm_init(void)
472473
REGISTER_HELPER(zend_jit_assign_obj_op_helper);
473474
REGISTER_HELPER(zend_jit_assign_to_typed_prop);
474475
REGISTER_HELPER(zend_jit_assign_op_to_typed_prop);
476+
REGISTER_HELPER(zend_jit_inc_typed_prop);
477+
REGISTER_HELPER(zend_jit_dec_typed_prop);
478+
REGISTER_HELPER(zend_jit_pre_inc_typed_prop);
479+
REGISTER_HELPER(zend_jit_pre_dec_typed_prop);
480+
REGISTER_HELPER(zend_jit_post_inc_typed_prop);
481+
REGISTER_HELPER(zend_jit_post_dec_typed_prop);
482+
REGISTER_HELPER(zend_jit_pre_inc_obj_helper);
483+
REGISTER_HELPER(zend_jit_pre_dec_obj_helper);
484+
REGISTER_HELPER(zend_jit_post_inc_obj_helper);
485+
REGISTER_HELPER(zend_jit_post_dec_obj_helper);
475486
#undef REGISTER_HELPER
476487

477488
#ifndef _WIN32

0 commit comments

Comments
 (0)