Skip to content

Commit d9e441b

Browse files
committed
Better CPU registers usage
1 parent 59401aa commit d9e441b

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14823,21 +14823,21 @@ static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t o
1482314823

1482414824
| // array = EX_VAR(opline->op1.var);
1482514825
| // fe_ht = Z_ARRVAL_P(array);
14826-
| GET_ZVAL_PTR FCARG2a, op1_addr
14826+
| GET_ZVAL_PTR FCARG1a, op1_addr
1482714827
| // pos = Z_FE_POS_P(array);
14828-
| mov FCARG1d, dword [FP + opline->op1.var + offsetof(zval, u2.fe_pos)]
14828+
| mov eax, dword [FP + opline->op1.var + offsetof(zval, u2.fe_pos)]
1482914829
| // p = fe_ht->arData + pos;
1483014830
|.if X64
1483114831
|| ZEND_ASSERT(sizeof(Bucket) == 32);
14832-
| mov eax, FCARG1d
14833-
| shl r0, 5
14832+
| mov FCARG2d, eax
14833+
| shl FCARG2a, 5
1483414834
|.else
14835-
| imul r0, FCARG1a, sizeof(Bucket)
14835+
| imul FCARG2a, r0, sizeof(Bucket)
1483614836
|.endif
14837-
| add r0, aword [FCARG2a + offsetof(zend_array, arData)]
14837+
| add FCARG2a, aword [FCARG1a + offsetof(zend_array, arData)]
1483814838
|1:
1483914839
| // if (UNEXPECTED(pos >= fe_ht->nNumUsed)) {
14840-
| cmp dword [FCARG2a + offsetof(zend_array, nNumUsed)], FCARG1d
14840+
| cmp dword [FCARG1a + offsetof(zend_array, nNumUsed)], eax
1484114841
| // ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
1484214842
| // ZEND_VM_CONTINUE();
1484314843
if (exit_addr) {
@@ -14850,16 +14850,16 @@ static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t o
1485014850
| jbe =>target_label
1485114851
}
1485214852
| // pos++;
14853-
| add FCARG1d, 1
14853+
| add eax, 1
1485414854
| // value_type = Z_TYPE_INFO_P(value);
1485514855
| // if (EXPECTED(value_type != IS_UNDEF)) {
1485614856
if (!exit_addr || exit_opcode == ZEND_JMP) {
14857-
| IF_NOT_Z_TYPE r0, IS_UNDEF, >3
14857+
| IF_NOT_Z_TYPE FCARG2a, IS_UNDEF, >3
1485814858
} else {
14859-
| IF_NOT_Z_TYPE r0, IS_UNDEF, &exit_addr
14859+
| IF_NOT_Z_TYPE FCARG2a, IS_UNDEF, &exit_addr
1486014860
}
1486114861
| // p++;
14862-
| add r0, sizeof(Bucket)
14862+
| add FCARG2a, sizeof(Bucket)
1486314863
| jmp <1
1486414864
|3:
1486514865

@@ -14868,29 +14868,28 @@ static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t o
1486814868
zend_jit_addr var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op2.var);
1486914869
uint32_t val_info;
1487014870

14871-
| mov FCARG2a, r0
1487214871
| // Z_FE_POS_P(array) = pos + 1;
14873-
| mov dword [FP + opline->op1.var + offsetof(zval, u2.fe_pos)], FCARG1d
14872+
| mov dword [FP + opline->op1.var + offsetof(zval, u2.fe_pos)], eax
1487414873

1487514874
if (RETURN_VALUE_USED(opline)) {
1487614875
zend_jit_addr res_addr = RES_ADDR();
1487714876

1487814877
if ((op1_info & MAY_BE_ARRAY_KEY_LONG)
1487914878
&& (op1_info & MAY_BE_ARRAY_KEY_STRING)) {
1488014879
| // if (!p->key) {
14881-
| cmp aword [r0 + offsetof(Bucket, key)], 0
14880+
| cmp aword [FCARG2a + offsetof(Bucket, key)], 0
1488214881
| jz >2
1488314882
}
1488414883
if (op1_info & MAY_BE_ARRAY_KEY_STRING) {
1488514884
| // ZVAL_STR_COPY(EX_VAR(opline->result.var), p->key);
14886-
| mov FCARG1a, aword [r0 + offsetof(Bucket, key)]
14887-
| SET_ZVAL_PTR res_addr, FCARG1a
14888-
| test dword [FCARG1a + offsetof(zend_refcounted, gc.u.type_info)], IS_STR_INTERNED
14885+
| mov r0, aword [FCARG2a + offsetof(Bucket, key)]
14886+
| SET_ZVAL_PTR res_addr, r0
14887+
| test dword [r0 + offsetof(zend_refcounted, gc.u.type_info)], IS_STR_INTERNED
1488914888
| jz >1
1489014889
| SET_ZVAL_TYPE_INFO res_addr, IS_STRING
1489114890
| jmp >3
1489214891
|1:
14893-
| GC_ADDREF FCARG1a
14892+
| GC_ADDREF r0
1489414893
| SET_ZVAL_TYPE_INFO res_addr, IS_STRING_EX
1489514894

1489614895
if (op1_info & MAY_BE_ARRAY_KEY_LONG) {
@@ -14900,8 +14899,8 @@ static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t o
1490014899
}
1490114900
if (op1_info & MAY_BE_ARRAY_KEY_LONG) {
1490214901
| // ZVAL_LONG(EX_VAR(opline->result.var), p->h);
14903-
| mov FCARG1a, aword [r0 + offsetof(Bucket, h)]
14904-
| SET_ZVAL_LVAL res_addr, FCARG1a
14902+
| mov r0, aword [FCARG2a + offsetof(Bucket, h)]
14903+
| SET_ZVAL_LVAL res_addr, r0
1490514904
| SET_ZVAL_TYPE_INFO res_addr, IS_LONG
1490614905
}
1490714906
|3:

0 commit comments

Comments
 (0)