summaryrefslogtreecommitdiff
path: root/ext/opcache/jit/zend_jit.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2020-09-14 13:31:41 +0300
committerDmitry Stogov <dmitry@zend.com>2020-09-14 13:31:41 +0300
commitbf515649ff7840f7180b02b04ada8bc8587c70c6 (patch)
tree61673618d0f9adff1218cd41ca5032f0258535aa /ext/opcache/jit/zend_jit.c
parent950ea89fb0dbf8d80d9392bd74d8e95d25b85de1 (diff)
downloadphp-git-bf515649ff7840f7180b02b04ada8bc8587c70c6.tar.gz
JIT for ASSIGN_OBJ_OP
Diffstat (limited to 'ext/opcache/jit/zend_jit.c')
-rw-r--r--ext/opcache/jit/zend_jit.c49
1 files changed, 47 insertions, 2 deletions
diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c
index f57744c8de..939a0a1cb4 100644
--- a/ext/opcache/jit/zend_jit.c
+++ b/ext/opcache/jit/zend_jit.c
@@ -2457,10 +2457,55 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
goto jit_failure;
}
goto done;
- case ZEND_ASSIGN_OBJ:
- if (opline->op1_type == IS_VAR) {
+ case ZEND_ASSIGN_OBJ_OP:
+ if (opline->extended_value == ZEND_POW
+ || opline->extended_value == ZEND_DIV) {
+ // TODO: check for division by zero ???
+ break;
+ }
+ if (opline->result_type != IS_UNUSED) {
+ break;
+ }
+ if (opline->op2_type != IS_CONST
+ || Z_TYPE_P(RT_CONSTANT(opline, opline->op2)) != IS_STRING
+ || Z_STRVAL_P(RT_CONSTANT(opline, opline->op2))[0] == '\0') {
break;
}
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ break;
+ }
+ ce = NULL;
+ ce_is_instanceof = 0;
+ if (opline->op1_type == IS_UNUSED) {
+ op1_info = MAY_BE_OBJECT|MAY_BE_RC1|MAY_BE_RCN;
+ ce = op_array->scope;
+ ce_is_instanceof = (ce->ce_flags & ZEND_ACC_FINAL) != 0;
+ op1_addr = 0;
+ } else {
+ op1_info = OP1_INFO();
+ if (!(op1_info & MAY_BE_OBJECT)) {
+ break;
+ }
+ op1_addr = OP1_REG_ADDR();
+ if (ssa->var_info && ssa->ops) {
+ zend_ssa_op *ssa_op = &ssa->ops[opline - op_array->opcodes];
+ if (ssa_op->op1_use >= 0) {
+ zend_ssa_var_info *op1_ssa = ssa->var_info + ssa_op->op1_use;
+ if (op1_ssa->ce && !op1_ssa->ce->create_object) {
+ ce = op1_ssa->ce;
+ ce_is_instanceof = op1_ssa->is_instanceof;
+ }
+ }
+ }
+ }
+ if (!zend_jit_assign_obj_op(&dasm_state, opline, op_array, ssa, ssa_op,
+ op1_info, op1_addr, OP1_DATA_INFO(), OP1_DATA_RANGE(),
+ 0, ce, ce_is_instanceof, 0, NULL,
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_ASSIGN_OBJ:
if (opline->op2_type != IS_CONST
|| Z_TYPE_P(RT_CONSTANT(opline, opline->op2)) != IS_STRING
|| Z_STRVAL_P(RT_CONSTANT(opline, opline->op2))[0] == '\0') {