Skip to content

Commit 8047c1d

Browse files
committed
Prefer shorter x86 instructions
1 parent 864fb0e commit 8047c1d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,11 @@ static void* dasm_labels[zend_lb_MAX];
11561156
|| }
11571157
|.endmacro
11581158

1159+
|.macro IF_UNDEF, type_reg, label
1160+
| test type_reg, type_reg
1161+
| je label
1162+
|.endmacro
1163+
11591164
|.macro IF_TYPE, type, val, label
11601165
| cmp type, val
11611166
| je label
@@ -1204,7 +1209,9 @@ static void* dasm_labels[zend_lb_MAX];
12041209
|.endmacro
12051210

12061211
|.macro IF_NOT_REFCOUNTED, type_flags, label
1207-
| IF_NOT_FLAGS type_flags, IS_TYPE_REFCOUNTED, label
1212+
| //IF_NOT_FLAGS type_flags, IS_TYPE_REFCOUNTED, label
1213+
| test type_flags, type_flags
1214+
| jz label
12081215
|.endmacro
12091216

12101217
|.macro IF_ZVAL_FLAGS, addr, mask, label
@@ -10767,7 +10774,7 @@ static int zend_jit_fetch_obj_read(dasm_State **Dst, const zend_op *opline, cons
1076710774
| jl >8 // dynamic property
1076810775
}
1076910776
| mov edx, dword [FCARG1a + r0 + 8]
10770-
| IF_TYPE dl, IS_UNDEF, >5
10777+
| IF_UNDEF dl, >5
1077110778
| add FCARG1a, r0
1077210779
prop_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
1077310780
} else {
@@ -10780,9 +10787,9 @@ static int zend_jit_fetch_obj_read(dasm_State **Dst, const zend_op *opline, cons
1078010787
if (!exit_addr) {
1078110788
return 0;
1078210789
}
10783-
| IF_TYPE dl, IS_UNDEF, &exit_addr
10790+
| IF_UNDEF dl, &exit_addr
1078410791
} else {
10785-
| IF_TYPE dl, IS_UNDEF, >5
10792+
| IF_UNDEF dl, >5
1078610793
}
1078710794
}
1078810795
| GET_ZVAL_PTR r0, prop_addr

0 commit comments

Comments
 (0)