Skip to content

Commit

Permalink
JIT: Cleanup dead and duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed Oct 14, 2021
1 parent e22b305 commit 7193909
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 71 deletions.
42 changes: 6 additions & 36 deletions ext/opcache/jit/zend_jit_arm64.dasc
Original file line number Diff line number Diff line change
Expand Up @@ -9214,39 +9214,12 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
| str REG2, EX:RX->run_time_cache
}
} else {
// Always defined as ZEND_MAP_PTR_KIND_PTR_OR_OFFSET. See Zend/zend_map_ptr.h.
#if ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR
if (func) {
| ldr REG0, EX:RX->func
}
| ldr REG2, [REG0, #offsetof(zend_op_array, run_time_cache__ptr)]
| ldr REG2, [REG2]
#elif ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR_OR_OFFSET
if (func && !(func->op_array.fn_flags & ZEND_ACC_CLOSURE)) {
if (ZEND_MAP_PTR_IS_OFFSET(func->op_array.run_time_cache)) {
| MEM_LOAD_64_ZTS ldr, REG2, compiler_globals, map_ptr_base, TMP1
| ADD_SUB_64_WITH_CONST add, REG2, REG2, (uintptr_t)ZEND_MAP_PTR(func->op_array.run_time_cache), TMP1
| ldr REG2, [REG2]
} else if ((func->op_array.fn_flags & ZEND_ACC_IMMUTABLE)
&& (!func->op_array.scope || (func->op_array.scope->ce_flags & ZEND_ACC_LINKED))) {
if (func) {
| ldr REG0, EX:RX->func
}
| ldr REG2, [REG0, #offsetof(zend_op_array, run_time_cache__ptr)]
| MEM_LOAD_OP_ZTS add, ldr, REG2, compiler_globals, map_ptr_base, REG1, TMP1
| ldr REG2, [REG2]
} else {
/* the called op_array may be not persisted yet */
if (func) {
| ldr REG0, EX:RX->func
}
| ldr REG2, [REG0, #offsetof(zend_op_array, run_time_cache__ptr)]
| TST_64_WITH_ONE REG2
| beq >1
| MEM_LOAD_OP_ZTS add, ldr, REG2, compiler_globals, map_ptr_base, REG1, TMP1
| ldr REG2, [REG2]
|1:
}
if (func
&& !(func->op_array.fn_flags & ZEND_ACC_CLOSURE)
&& ZEND_MAP_PTR_IS_OFFSET(func->op_array.run_time_cache)) {
| MEM_LOAD_64_ZTS ldr, REG2, compiler_globals, map_ptr_base, TMP1
| ADD_SUB_64_WITH_CONST add, REG2, REG2, (uintptr_t)ZEND_MAP_PTR(func->op_array.run_time_cache), TMP1
| ldr REG2, [REG2]
} else {
if (func) {
| ldr REG0, EX:RX->func
Expand All @@ -9258,9 +9231,6 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
| ldr REG2, [REG2]
|1:
}
#else
# error "Unknown ZEND_MAP_PTR_KIND"
#endif
| str REG2, EX:RX->run_time_cache
}
}
Expand Down
40 changes: 5 additions & 35 deletions ext/opcache/jit/zend_jit_x86.dasc
Original file line number Diff line number Diff line change
Expand Up @@ -9854,38 +9854,11 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
| mov EX:RX->run_time_cache, r2
}
} else {
// Always defined as ZEND_MAP_PTR_KIND_PTR_OR_OFFSET. See Zend/zend_map_ptr.h.
#if ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR
if (func) {
| mov r0, EX:RX->func
}
| mov r2, aword [r0 + offsetof(zend_op_array, run_time_cache__ptr)]
| mov r2, aword [r2]
#elif ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR_OR_OFFSET
if (func && !(func->op_array.fn_flags & ZEND_ACC_CLOSURE)) {
if (ZEND_MAP_PTR_IS_OFFSET(func->op_array.run_time_cache)) {
| MEM_LOAD_ZTS r2, aword, compiler_globals, map_ptr_base, r1
| mov r2, aword [r2 + (uintptr_t)ZEND_MAP_PTR(func->op_array.run_time_cache)]
} else if ((func->op_array.fn_flags & ZEND_ACC_IMMUTABLE)
&& (!func->op_array.scope || (func->op_array.scope->ce_flags & ZEND_ACC_LINKED))) {
if (func) {
| mov r0, EX:RX->func
}
| mov r2, aword [r0 + offsetof(zend_op_array, run_time_cache__ptr)]
| MEM_LOAD_OP_ZTS add, r2, aword, compiler_globals, map_ptr_base, r1
| mov r2, aword [r2]
} else {
/* the called op_array may be not persisted yet */
if (func) {
| mov r0, EX:RX->func
}
| mov r2, aword [r0 + offsetof(zend_op_array, run_time_cache__ptr)]
| test r2, 1
| jz >1
| MEM_LOAD_OP_ZTS add, r2, aword, compiler_globals, map_ptr_base, r1
| mov r2, aword [r2]
|1:
}
if (func
&& !(func->op_array.fn_flags & ZEND_ACC_CLOSURE)
&& ZEND_MAP_PTR_IS_OFFSET(func->op_array.run_time_cache)) {
| MEM_LOAD_ZTS r2, aword, compiler_globals, map_ptr_base, r1
| mov r2, aword [r2 + (uintptr_t)ZEND_MAP_PTR(func->op_array.run_time_cache)]
} else {
if (func) {
| mov r0, EX:RX->func
Expand All @@ -9897,9 +9870,6 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
| mov r2, aword [r2]
|1:
}
#else
# error "Unknown ZEND_MAP_PTR_KIND"
#endif
| mov EX:RX->run_time_cache, r2
}
}
Expand Down

0 comments on commit 7193909

Please sign in to comment.