Skip to content

Commit 5872bfc

Browse files
committed
Use RIP-relative addressing
1 parent 67828ab commit 5872bfc

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11440,7 +11440,12 @@ static int zend_jit_switch(dasm_State **Dst, const zend_op *opline, const zend_o
1144011440
| cmp FCARG2a, jumptable->nNumUsed
1144111441
| jae >3
1144211442
|.if X64
11443-
| jmp aword [FCARG2a * 8 + >4]
11443+
if (!IS_32BIT(dasm_end)) {
11444+
| lea r0, aword [>4]
11445+
| jmp aword [r0 + FCARG2a * 8]
11446+
} else {
11447+
| jmp aword [FCARG2a * 8 + >4]
11448+
}
1144411449
|.else
1144511450
| jmp aword [FCARG2a * 4 + >4]
1144611451
|.endif
@@ -11474,7 +11479,16 @@ static int zend_jit_switch(dasm_State **Dst, const zend_op *opline, const zend_o
1147411479
| cdq
1147511480
|.endif
1147611481
| idiv FCARG1a
11482+
|.if X64
11483+
if (!IS_32BIT(dasm_end)) {
11484+
| lea FCARG1a, aword [>4]
11485+
| jmp aword [FCARG1a + r0]
11486+
} else {
11487+
| jmp aword [r0 + >4]
11488+
}
11489+
|.else
1147711490
| jmp aword [r0 + >4]
11491+
|.endif
1147811492
|3:
1147911493
|.cold_code
1148011494
|.align aword
@@ -11520,7 +11534,16 @@ static int zend_jit_switch(dasm_State **Dst, const zend_op *opline, const zend_o
1152011534
| cdq
1152111535
|.endif
1152211536
| idiv FCARG1a
11537+
|.if X64
11538+
if (!IS_32BIT(dasm_end)) {
11539+
| lea FCARG1a, aword [>4]
11540+
| jmp aword [FCARG1a + r0]
11541+
} else {
11542+
| jmp aword [r0 + >4]
11543+
}
11544+
|.else
1152311545
| jmp aword [r0 + >4]
11546+
|.endif
1152411547
|3:
1152511548
|.cold_code
1152611549
|.align aword

0 commit comments

Comments
 (0)