Skip to content

Commit 93aaf68

Browse files
committed
cleanup
1 parent 92c4b06 commit 93aaf68

File tree

1 file changed

+31
-39
lines changed

1 file changed

+31
-39
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ static void* dasm_labels[zend_lb_MAX];
10221022
|.endmacro
10231023

10241024
/* the same as above, but "src" may overlap with "tmp_reg1" */
1025-
|.macro ZVAL_COPY_VALUE, dst_addr, dst_info, src_addr, src_info, tmp_reg1, tmp_reg2, src_loaded
1025+
|.macro ZVAL_COPY_VALUE, dst_addr, dst_info, src_addr, src_info, tmp_reg1, tmp_reg2
10261026
|| if (src_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE))) {
10271027
|| if ((src_info & MAY_BE_ANY) == MAY_BE_LONG) {
10281028
|| if (Z_MODE(src_addr) == IS_REG) {
@@ -1032,9 +1032,7 @@ static void* dasm_labels[zend_lb_MAX];
10321032
|| } else if (Z_MODE(dst_addr) == IS_REG) {
10331033
| GET_ZVAL_LVAL Z_REG(dst_addr), src_addr
10341034
|| } else {
1035-
|| if (!src_loaded) {
1036-
| GET_ZVAL_LVAL tmp_reg2, src_addr
1037-
|| }
1035+
| GET_ZVAL_LVAL tmp_reg2, src_addr
10381036
| SET_ZVAL_LVAL dst_addr, Ra(tmp_reg2)
10391037
|| }
10401038
|| } else if ((src_info & MAY_BE_ANY) == MAY_BE_DOUBLE) {
@@ -1047,26 +1045,20 @@ static void* dasm_labels[zend_lb_MAX];
10471045
| SSE_SET_ZVAL_DVAL dst_addr, ZREG_XMM0
10481046
|| }
10491047
|| } else if (!(src_info & MAY_BE_DOUBLE)) {
1050-
|| if (!src_loaded) {
1051-
| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
1052-
|| }
1048+
| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
10531049
| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
10541050
|| } else {
10551051
| .if X64
1056-
|| if (!src_loaded) {
1057-
| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
1058-
|| }
1052+
| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
10591053
| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
10601054
| .else
1061-
|| if ((tmp_reg1 == tmp_reg2 || tmp_reg1 == Z_REG(src_addr)) && !src_loaded) {
1055+
|| if ((tmp_reg1 == tmp_reg2 || tmp_reg1 == Z_REG(src_addr))) {
10621056
| GET_ZVAL_W2 Ra(tmp_reg2), src_addr
10631057
| SET_ZVAL_W2 dst_addr, Ra(tmp_reg2)
10641058
| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
10651059
| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
10661060
|| } else {
1067-
|| if (!src_loaded) {
1068-
| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
1069-
|| }
1061+
| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
10701062
| GET_ZVAL_W2 Ra(tmp_reg1), src_addr
10711063
| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
10721064
| SET_ZVAL_W2 dst_addr, Ra(tmp_reg1)
@@ -3559,7 +3551,7 @@ static int zend_jit_inc_dec(dasm_State **Dst, const zend_op *opline, const zend_
35593551
| IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >2
35603552
}
35613553
if (opline->opcode == ZEND_POST_INC || opline->opcode == ZEND_POST_DEC) {
3562-
| ZVAL_COPY_VALUE res_addr, res_use_info, op1_addr, MAY_BE_LONG, ZREG_R0, ZREG_R1, 0
3554+
| ZVAL_COPY_VALUE res_addr, res_use_info, op1_addr, MAY_BE_LONG, ZREG_R0, ZREG_R1
35633555
}
35643556
if (!zend_jit_update_regs(Dst, op1_addr, op1_def_addr, MAY_BE_LONG)) {
35653557
return 0;
@@ -3609,7 +3601,7 @@ static int zend_jit_inc_dec(dasm_State **Dst, const zend_op *opline, const zend_
36093601

36103602
if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&
36113603
opline->result_type != IS_UNUSED) {
3612-
| ZVAL_COPY_VALUE res_addr, res_use_info, op1_def_addr, MAY_BE_LONG, ZREG_R0, ZREG_R1, 0
3604+
| ZVAL_COPY_VALUE res_addr, res_use_info, op1_def_addr, MAY_BE_LONG, ZREG_R0, ZREG_R1
36133605
}
36143606

36153607
SET_STACK_INFO(stack, EX_VAR_TO_NUM(opline->op1.var), old_op1_info);
@@ -3620,7 +3612,7 @@ static int zend_jit_inc_dec(dasm_State **Dst, const zend_op *opline, const zend_
36203612
| jo >1
36213613
if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&
36223614
opline->result_type != IS_UNUSED) {
3623-
| ZVAL_COPY_VALUE res_addr, res_use_info, op1_def_addr, MAY_BE_LONG, ZREG_R0, ZREG_R1, 0
3615+
| ZVAL_COPY_VALUE res_addr, res_use_info, op1_def_addr, MAY_BE_LONG, ZREG_R0, ZREG_R1
36243616
}
36253617
|.cold_code
36263618
|1:
@@ -3646,14 +3638,14 @@ static int zend_jit_inc_dec(dasm_State **Dst, const zend_op *opline, const zend_
36463638
}
36473639
if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&
36483640
opline->result_type != IS_UNUSED) {
3649-
| ZVAL_COPY_VALUE res_addr, res_use_info, op1_def_addr, MAY_BE_DOUBLE, ZREG_R0, ZREG_R1, 0
3641+
| ZVAL_COPY_VALUE res_addr, res_use_info, op1_def_addr, MAY_BE_DOUBLE, ZREG_R0, ZREG_R1
36503642
}
36513643
| jmp >3
36523644
|.code
36533645
} else {
36543646
if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&
36553647
opline->result_type != IS_UNUSED) {
3656-
| ZVAL_COPY_VALUE res_addr, res_use_info, op1_def_addr, MAY_BE_LONG, ZREG_R0, ZREG_R1, 0
3648+
| ZVAL_COPY_VALUE res_addr, res_use_info, op1_def_addr, MAY_BE_LONG, ZREG_R0, ZREG_R1
36573649
}
36583650
}
36593651
if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG)) {
@@ -3715,7 +3707,7 @@ static int zend_jit_inc_dec(dasm_State **Dst, const zend_op *opline, const zend_
37153707
if (opline->opcode == ZEND_POST_INC || opline->opcode == ZEND_POST_DEC) {
37163708
zend_jit_addr val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
37173709

3718-
| ZVAL_COPY_VALUE res_addr, res_use_info, val_addr, op1_info, ZREG_R0, ZREG_R2, 0
3710+
| ZVAL_COPY_VALUE res_addr, res_use_info, val_addr, op1_info, ZREG_R0, ZREG_R2
37193711
| TRY_ADDREF op1_info, ah, r2
37203712
}
37213713
if (opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_POST_INC) {
@@ -3740,7 +3732,7 @@ static int zend_jit_inc_dec(dasm_State **Dst, const zend_op *opline, const zend_
37403732
zend_reg tmp_reg;
37413733

37423734
if (opline->opcode == ZEND_POST_INC || opline->opcode == ZEND_POST_DEC) {
3743-
| ZVAL_COPY_VALUE res_addr, res_use_info, op1_addr, MAY_BE_DOUBLE, ZREG_R0, ZREG_R2, 0
3735+
| ZVAL_COPY_VALUE res_addr, res_use_info, op1_addr, MAY_BE_DOUBLE, ZREG_R0, ZREG_R2
37443736
}
37453737
if (Z_MODE(op1_def_addr) == IS_REG) {
37463738
tmp_reg = Z_REG(op1_def_addr);
@@ -3766,7 +3758,7 @@ static int zend_jit_inc_dec(dasm_State **Dst, const zend_op *opline, const zend_
37663758
| SSE_SET_ZVAL_DVAL op1_def_addr, tmp_reg
37673759
if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&
37683760
opline->result_type != IS_UNUSED) {
3769-
| ZVAL_COPY_VALUE res_addr, res_use_info, op1_addr, op1_def_info, ZREG_R0, ZREG_R1, 0
3761+
| ZVAL_COPY_VALUE res_addr, res_use_info, op1_addr, op1_def_info, ZREG_R0, ZREG_R1
37703762
| TRY_ADDREF op1_def_info, ah, r1
37713763
}
37723764
}
@@ -5207,7 +5199,7 @@ static int zend_jit_simple_assign(dasm_State **Dst,
52075199
| // ZVAL_COPY_VALUE(return_value, &ref->value);
52085200
ref_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R2, 8);
52095201
if (!res_addr) {
5210-
| ZVAL_COPY_VALUE var_addr, var_info, ref_addr, val_info, ZREG_R2, ZREG_R0, 0
5202+
| ZVAL_COPY_VALUE var_addr, var_info, ref_addr, val_info, ZREG_R2, ZREG_R0
52115203
} else {
52125204
| ZVAL_COPY_VALUE_2 var_addr, var_info, res_addr, ref_addr, val_info, ZREG_R2, ZREG_R0
52135205
}
@@ -5236,7 +5228,7 @@ static int zend_jit_simple_assign(dasm_State **Dst,
52365228
}
52375229

52385230
if (!res_addr) {
5239-
| ZVAL_COPY_VALUE var_addr, var_info, val_addr, val_info, ZREG_R2, ZREG_R0, 0
5231+
| ZVAL_COPY_VALUE var_addr, var_info, val_addr, val_info, ZREG_R2, ZREG_R0
52405232
} else {
52415233
| ZVAL_COPY_VALUE_2 var_addr, var_info, res_addr, val_addr, val_info, ZREG_R2, ZREG_R0
52425234
}
@@ -8901,7 +8893,7 @@ static int zend_jit_send_val(dasm_State **Dst, const zend_op *opline, const zend
89018893
| ADDREF_CONST zv, r0
89028894
}
89038895
} else {
8904-
| ZVAL_COPY_VALUE arg_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R0, ZREG_R2, 0
8896+
| ZVAL_COPY_VALUE arg_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R0, ZREG_R2
89058897
}
89068898

89078899
return 1;
@@ -8970,11 +8962,11 @@ static int zend_jit_send_ref(dasm_State **Dst, const zend_op *opline, const zend
89708962
zend_jit_addr val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R1, 0);
89718963

89728964
| mov r1, aword T1 // restore
8973-
| ZVAL_COPY_VALUE ref_addr, MAY_BE_ANY, val_addr, op1_info, ZREG_R2, ZREG_R2, 0
8965+
| ZVAL_COPY_VALUE ref_addr, MAY_BE_ANY, val_addr, op1_info, ZREG_R2, ZREG_R2
89748966
| SET_ZVAL_PTR val_addr, r0
89758967
| SET_ZVAL_TYPE_INFO val_addr, IS_REFERENCE_EX
89768968
} else {
8977-
| ZVAL_COPY_VALUE ref_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R1, ZREG_R2, 0
8969+
| ZVAL_COPY_VALUE ref_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R1, ZREG_R2
89788970
| SET_ZVAL_PTR op1_addr, r0
89798971
| SET_ZVAL_TYPE_INFO op1_addr, IS_REFERENCE_EX
89808972
}
@@ -9038,7 +9030,7 @@ static int zend_jit_send_var(dasm_State **Dst, const zend_op *opline, const zend
90389030
&& JIT_G(current_frame)->call->func) {
90399031
if (ARG_SHOULD_BE_SENT_BY_REF(JIT_G(current_frame)->call->func, arg_num)) {
90409032

9041-
| ZVAL_COPY_VALUE arg_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R1, ZREG_R2, 0
9033+
| ZVAL_COPY_VALUE arg_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R1, ZREG_R2
90429034

90439035
if (!ARG_MAY_BE_SENT_BY_REF(JIT_G(current_frame)->call->func, arg_num)) {
90449036
if (!(op1_info & MAY_BE_REF)) {
@@ -9067,7 +9059,7 @@ static int zend_jit_send_var(dasm_State **Dst, const zend_op *opline, const zend
90679059

90689060
mask = ZEND_SEND_PREFER_REF << ((arg_num + 3) * 2);
90699061

9070-
| ZVAL_COPY_VALUE arg_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R1, ZREG_R2, 0
9062+
| ZVAL_COPY_VALUE arg_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R1, ZREG_R2
90719063
if (op1_info & MAY_BE_REF) {
90729064
| cmp cl, IS_REFERENCE
90739065
| je >7
@@ -9139,7 +9131,7 @@ static int zend_jit_send_var(dasm_State **Dst, const zend_op *opline, const zend
91399131
}
91409132

91419133
if (opline->opcode == ZEND_SEND_VAR_NO_REF) {
9142-
| ZVAL_COPY_VALUE arg_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R1, ZREG_R2, 0
9134+
| ZVAL_COPY_VALUE arg_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R1, ZREG_R2
91439135
if (op1_info & MAY_BE_REF) {
91449136
| cmp cl, IS_REFERENCE
91459137
| je >7
@@ -9166,7 +9158,7 @@ static int zend_jit_send_var(dasm_State **Dst, const zend_op *opline, const zend
91669158

91679159
| LOAD_ZVAL_ADDR FCARG1a, op1_addr
91689160
| ZVAL_DEREF FCARG1a, op1_info
9169-
| ZVAL_COPY_VALUE arg_addr, MAY_BE_ANY, val_addr, op1_info, ZREG_R0, ZREG_R2, 0
9161+
| ZVAL_COPY_VALUE arg_addr, MAY_BE_ANY, val_addr, op1_info, ZREG_R0, ZREG_R2
91709162
| TRY_ADDREF op1_info, ah, r2
91719163
} else {
91729164
zend_jit_addr ref_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 8);
@@ -9177,7 +9169,7 @@ static int zend_jit_send_var(dasm_State **Dst, const zend_op *opline, const zend
91779169
| // zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
91789170
| GET_ZVAL_PTR FCARG1a, op1_addr
91799171
| // ZVAL_COPY_VALUE(return_value, &ref->value);
9180-
| ZVAL_COPY_VALUE arg_addr, MAY_BE_ANY, ref_addr, op1_info, ZREG_R0, ZREG_R2, 0
9172+
| ZVAL_COPY_VALUE arg_addr, MAY_BE_ANY, ref_addr, op1_info, ZREG_R0, ZREG_R2
91819173
| GC_DELREF FCARG1a
91829174
| je >1
91839175
| IF_NOT_REFCOUNTED ah, >2
@@ -9187,7 +9179,7 @@ static int zend_jit_send_var(dasm_State **Dst, const zend_op *opline, const zend
91879179
| EFREE_REG_24 op_array, opline
91889180
| jmp >2
91899181
|.code
9190-
| ZVAL_COPY_VALUE arg_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R0, ZREG_R2, 0
9182+
| ZVAL_COPY_VALUE arg_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R0, ZREG_R2
91919183
|2:
91929184
}
91939185
} else {
@@ -9199,7 +9191,7 @@ static int zend_jit_send_var(dasm_State **Dst, const zend_op *opline, const zend
91999191
op1_addr= op1_def_addr;
92009192
}
92019193
}
9202-
| ZVAL_COPY_VALUE arg_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R0, ZREG_R2, 0
9194+
| ZVAL_COPY_VALUE arg_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R0, ZREG_R2
92039195
if (opline->op1_type == IS_CV) {
92049196
| TRY_ADDREF op1_info, ah, r2
92059197
}
@@ -9972,14 +9964,14 @@ static int zend_jit_return(dasm_State **Dst, const zend_op *opline, const zend_o
99729964
| ADDREF_CONST zv, r0
99739965
}
99749966
} else if (opline->op1_type == IS_TMP_VAR) {
9975-
| ZVAL_COPY_VALUE ret_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R0, ZREG_R2, 0
9967+
| ZVAL_COPY_VALUE ret_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R0, ZREG_R2
99769968
} else if (opline->op1_type == IS_CV) {
99779969
if (op1_info & MAY_BE_REF) {
99789970
| LOAD_ZVAL_ADDR r0, op1_addr
99799971
| ZVAL_DEREF r0, op1_info
99809972
op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R0, 0);
99819973
}
9982-
| ZVAL_COPY_VALUE ret_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R0, ZREG_R2, 0
9974+
| ZVAL_COPY_VALUE ret_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R0, ZREG_R2
99839975
if (JIT_G(trigger) != ZEND_JIT_ON_HOT_TRACE || (op1_info & MAY_BE_REF) || (return_value_used != 1)) {
99849976
| // TODO: JIT: if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) ZVAL_NULL(retval_ptr); ???
99859977
| TRY_ADDREF op1_info, ah, r2
@@ -9994,7 +9986,7 @@ static int zend_jit_return(dasm_State **Dst, const zend_op *opline, const zend_o
99949986
| // zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
99959987
| GET_ZVAL_PTR r0, op1_addr
99969988
| // ZVAL_COPY_VALUE(return_value, &ref->value);
9997-
| ZVAL_COPY_VALUE ret_addr, MAY_BE_ANY, ref_addr, op1_info, ZREG_R2, ZREG_R2, 0
9989+
| ZVAL_COPY_VALUE ret_addr, MAY_BE_ANY, ref_addr, op1_info, ZREG_R2, ZREG_R2
99989990
| GC_DELREF r0
99999991
| je >2
100009992
| // if (IS_REFCOUNTED())
@@ -10020,7 +10012,7 @@ static int zend_jit_return(dasm_State **Dst, const zend_op *opline, const zend_o
1002010012
}
1002110013
|.code
1002210014
}
10023-
| ZVAL_COPY_VALUE ret_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R0, ZREG_R2, 0
10015+
| ZVAL_COPY_VALUE ret_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R0, ZREG_R2
1002410016
}
1002510017

1002610018
|9:
@@ -10236,7 +10228,7 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, const zend_op *opline, cons
1023610228
}
1023710229
} else {
1023810230
| // ZVAL_COPY
10239-
| ZVAL_COPY_VALUE res_addr, -1, val_addr, MAY_BE_ANY, ZREG_R1, ZREG_R2, 0
10231+
| ZVAL_COPY_VALUE res_addr, -1, val_addr, MAY_BE_ANY, ZREG_R1, ZREG_R2
1024010232
| TRY_ADDREF res_info, ch, r2
1024110233
}
1024210234
}

0 commit comments

Comments
 (0)