summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2020-09-14 23:30:49 +0300
committerDmitry Stogov <dmitry@zend.com>2020-09-14 23:30:49 +0300
commita4c3aee5b22a7e250ac5b89e25877261450cfe1d (patch)
tree196437aafa69c6bb487b7ab0d124559ab624e179
parenta351da55bf4cb000c267775c631534b5d513fbcd (diff)
downloadphp-git-a4c3aee5b22a7e250ac5b89e25877261450cfe1d.tar.gz
Support for reference
-rw-r--r--ext/opcache/jit/zend_jit.c2
-rw-r--r--ext/opcache/jit/zend_jit_trace.c20
-rw-r--r--ext/opcache/jit/zend_jit_x86.dasc8
3 files changed, 19 insertions, 11 deletions
diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c
index 04bb52f352..cfc391f0e8 100644
--- a/ext/opcache/jit/zend_jit.c
+++ b/ext/opcache/jit/zend_jit.c
@@ -3114,7 +3114,7 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
if ((op1_info & (MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF)) != MAY_BE_STRING) {
break;
}
- if (!zend_jit_strlen(&dasm_state, opline, op1_info)) {
+ if (!zend_jit_strlen(&dasm_state, opline, op1_info, OP1_REG_ADDR())) {
goto jit_failure;
}
goto done;
diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c
index ad1ea8d978..253ae68a7f 100644
--- a/ext/opcache/jit/zend_jit_trace.c
+++ b/ext/opcache/jit/zend_jit_trace.c
@@ -4860,11 +4860,23 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
goto done;
case ZEND_STRLEN:
op1_info = OP1_INFO();
- CHECK_OP1_TRACE_TYPE();
- if ((op1_info & (MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF)) != MAY_BE_STRING) {
- break;
+ op1_addr = OP1_REG_ADDR();
+ if (orig_op1_type == (IS_TRACE_REFERENCE|IS_STRING)) {
+ if (!zend_jit_fetch_reference(&dasm_state, opline, orig_op1_type, &op1_info, &op1_addr,
+ !ssa->var_info[ssa_op->op1_use].guarded_reference, 1)) {
+ goto jit_failure;
+ }
+ if (opline->op1_type == IS_CV
+ && zend_jit_var_may_alias(op_array, op_array_ssa, EX_VAR_TO_NUM(opline->op1.var)) == NO_ALIAS) {
+ ssa->var_info[ssa_op->op1_use].guarded_reference = 1;
+ }
+ } else {
+ CHECK_OP1_TRACE_TYPE();
+ if ((op1_info & (MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF)) != MAY_BE_STRING) {
+ break;
+ }
}
- if (!zend_jit_strlen(&dasm_state, opline, op1_info)) {
+ if (!zend_jit_strlen(&dasm_state, opline, op1_info, op1_addr)) {
goto jit_failure;
}
goto done;
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index cb23f44d0c..ae3763622e 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -13396,7 +13396,7 @@ static int zend_jit_echo(dasm_State **Dst, const zend_op *opline, uint32_t op1_i
return 1;
}
-static int zend_jit_strlen(dasm_State **Dst, const zend_op *opline, uint32_t op1_info)
+static int zend_jit_strlen(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_jit_addr op1_addr)
{
zend_jit_addr res_addr = RES_ADDR();
@@ -13411,17 +13411,13 @@ static int zend_jit_strlen(dasm_State **Dst, const zend_op *opline, uint32_t op1
| SET_ZVAL_LVAL res_addr, len
| SET_ZVAL_TYPE_INFO res_addr, IS_LONG
} else {
- zend_jit_addr op1_addr = OP1_ADDR();
-
ZEND_ASSERT((op1_info & (MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF)) == MAY_BE_STRING);
| GET_ZVAL_PTR r0, op1_addr
| mov r0, aword [r0 + offsetof(zend_string, len)]
| SET_ZVAL_LVAL res_addr, r0
| SET_ZVAL_TYPE_INFO res_addr, IS_LONG
- if (opline->op1_type & (IS_VAR|IS_TMP_VAR)) {
- | ZVAL_PTR_DTOR op1_addr, op1_info, 0, 0, opline
- }
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 0, opline
}
return 1;
}