com php-src: jump optimization: ext/opcache/jit/zend_jit.c ext/opcache/jit/zend_jit_x86.dasc
| From: | Dmitry Stogov | Date: | Wed, 03 Apr 2019 20:37:25 +0000 |
| Subject: | com php-src: jump optimization: ext/opcache/jit/zend_jit.c ext/opcache/jit/zend_jit_x86.dasc | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105516@lists.php.net to get a copy of this message | ||
Commit: a146e6eea7aeb395cfac9e706d81107a97009ed1
Author: Dmitry Stogov <dmitry@zend.com> Wed, 3 Apr 2019 23:37:25 +0300
Parents: 34d5c1b16fc0499548806b97e3d4c49a2756406a
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a146e6eea7aeb395cfac9e706d81107a97009ed1
Log:
jump optimization
Changed paths:
M ext/opcache/jit/zend_jit.c
M ext/opcache/jit/zend_jit_x86.dasc
Diff:
diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c
index fffab89..84defa0 100644
--- a/ext/opcache/jit/zend_jit.c
+++ b/ext/opcache/jit/zend_jit.c
@@ -2472,8 +2472,42 @@ static int zend_jit(zend_op_array *op_array, zend_ssa *ssa, const zend_op
*rt_op
}
break;
case ZEND_NEW:
- if (!zend_jit_new(&dasm_state, opline, &i, op_array, ssa, call_level)) {
- goto jit_failure;
+ if (!zend_jit_handler(&dasm_state, opline, 1)) {
+ return 0;
+ }
+ if (opline->extended_value == 0 && (opline+1)->opcode == ZEND_DO_FCALL) {
+ zend_class_entry *ce = NULL;
+
+ if (zend_jit_level >= ZEND_JIT_LEVEL_OPT_FUNC) {
+ if (ssa->ops && ssa->var_info) {
+ zend_ssa_var_info *res_ssa = &ssa->var_info[ssa->ops[opline -
op_array->opcodes].result_def];
+ if (res_ssa->ce && !res_ssa->is_instanceof) {
+ ce = res_ssa->ce;
+ }
+ }
+ } else {
+ if (opline->op1_type == IS_CONST) {
+ zval *zv = RT_CONSTANT(opline, opline->op1);
+ if (Z_TYPE_P(zv) == IS_STRING) {
+ zval *lc = zv + 1;
+ ce = (zend_class_entry*)zend_hash_find_ptr(EG(class_table), Z_STR_P(lc));
+ }
+ }
+ }
+
+ i++;
+
+ if (!ce || !(ce->ce_flags & ZEND_ACC_LINKED) || ce->constructor) {
+ const zend_op *next_opline = opline + 1;
+
+ zend_jit_cond_jmp(&dasm_state, next_opline, ssa->cfg.blocks[b].successors[0]);
+ if (zend_jit_level < ZEND_JIT_LEVEL_INLINE) {
+ zend_jit_call(&dasm_state, next_opline);
+ is_terminated = 1;
+ } else {
+ zend_jit_do_fcall(&dasm_state, next_opline, op_array, ssa, call_level);
+ }
+ }
}
break;
default:
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index 3b2da99..770aca2 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -7812,48 +7812,6 @@ fallback:
}
}
-static int zend_jit_new(dasm_State **Dst, const zend_op *opline, int *opnum, zend_op_array
*op_array, zend_ssa *ssa, int call_level)
-{
- if (!zend_jit_handler(Dst, opline, 1)) {
- return 0;
- }
- if (opline->extended_value == 0 && (opline+1)->opcode == ZEND_DO_FCALL) {
- zend_class_entry *ce = NULL;
-
- if (zend_jit_level >= ZEND_JIT_LEVEL_OPT_FUNC) {
- if (ssa->ops && ssa->var_info) {
- zend_ssa_var_info *res_ssa = &ssa->var_info[ssa->ops[opline -
op_array->opcodes].result_def];
- if (res_ssa->ce && !res_ssa->is_instanceof) {
- ce = res_ssa->ce;
- }
- }
- } else {
- if (opline->op1_type == IS_CONST) {
- zval *zv = RT_CONSTANT(opline, opline->op1);
- if (Z_TYPE_P(zv) == IS_STRING) {
- zval *lc = zv + 1;
- ce = (zend_class_entry*)zend_hash_find_ptr(EG(class_table), Z_STR_P(lc));
- }
- }
- }
-
- (*opnum)++;
- if (!ce || !(ce->ce_flags & ZEND_ACC_LINKED) || ce->constructor) {
- const zend_op *next_opline = opline + 1;
-
- | CMP_IP next_opline
- | jne >6
- if (zend_jit_level < ZEND_JIT_LEVEL_INLINE) {
- zend_jit_call(Dst, next_opline);
- } else {
- zend_jit_do_fcall(Dst, next_opline, op_array, ssa, call_level);
- }
- |6:
- }
- }
- return 1;
-}
-
static int zend_jit_send_val(dasm_State **Dst, const zend_op *opline, zend_op_array *op_array,
zend_ssa *ssa, zend_lifetime_interval **ra)
{
uint32_t op1_info;