|
 |
006bc1 |
From 7e662e4f87134f1e84f7bea80933e033c5bf53a3 Mon Sep 17 00:00:00 2001
|
|
 |
006bc1 |
From: Mike Pall <mike>
|
|
 |
006bc1 |
Date: Wed, 26 Jul 2017 09:52:53 +0200
|
|
 |
006bc1 |
Subject: [PATCH 09/72] x64/LJ_GC64: Fix emit_rma().
|
|
 |
006bc1 |
|
|
 |
006bc1 |
---
|
|
 |
006bc1 |
src/lj_emit_x86.h | 24 +++++++++++++++++++++---
|
|
 |
006bc1 |
1 file changed, 21 insertions(+), 3 deletions(-)
|
|
 |
006bc1 |
|
|
 |
006bc1 |
diff --git a/src/lj_emit_x86.h b/src/lj_emit_x86.h
|
|
 |
006bc1 |
index 5207f9d..5b139bd 100644
|
|
 |
006bc1 |
--- a/src/lj_emit_x86.h
|
|
 |
006bc1 |
+++ b/src/lj_emit_x86.h
|
|
 |
006bc1 |
@@ -343,9 +343,27 @@ static void emit_rma(ASMState *as, x86Op xo, Reg rr, const void *addr)
|
|
 |
006bc1 |
emit_rmro(as, xo, rr, RID_DISPATCH, (int32_t)dispofs(as, addr));
|
|
 |
006bc1 |
} else if (checki32(mcpofs(as, addr)) && checki32(mctopofs(as, addr))) {
|
|
 |
006bc1 |
emit_rmro(as, xo, rr, RID_RIP, (int32_t)mcpofs(as, addr));
|
|
 |
006bc1 |
- } else if (!checki32((intptr_t)addr) && (xo == XO_MOV || xo == XO_MOVSD)) {
|
|
 |
006bc1 |
- emit_rmro(as, xo, rr, rr, 0);
|
|
 |
006bc1 |
- emit_loadu64(as, rr, (uintptr_t)addr);
|
|
 |
006bc1 |
+ } else if (!checki32((intptr_t)addr)) {
|
|
 |
006bc1 |
+ Reg ra = (rr & 15);
|
|
 |
006bc1 |
+ if (xo != XO_MOV) {
|
|
 |
006bc1 |
+ /* We can't allocate a register here. Use and restore DISPATCH. Ugly. */
|
|
 |
006bc1 |
+ uint64_t dispaddr = (uintptr_t)J2GG(as->J)->dispatch;
|
|
 |
006bc1 |
+ uint8_t i8 = xo == XO_GROUP3b ? *as->mcp++ : 0;
|
|
 |
006bc1 |
+ ra = RID_DISPATCH;
|
|
 |
006bc1 |
+ if (checku32(dispaddr)) {
|
|
 |
006bc1 |
+ emit_loadi(as, ra, (int32_t)dispaddr);
|
|
 |
006bc1 |
+ } else { /* Full-size 64 bit load. */
|
|
 |
006bc1 |
+ MCode *p = as->mcp;
|
|
 |
006bc1 |
+ *(uint64_t *)(p-8) = dispaddr;
|
|
 |
006bc1 |
+ p[-9] = (MCode)(XI_MOVri+(ra&7));
|
|
 |
006bc1 |
+ p[-10] = 0x48 + ((ra>>3)&1;;
|
|
 |
006bc1 |
+ p -= 10;
|
|
 |
006bc1 |
+ as->mcp = p;
|
|
 |
006bc1 |
+ }
|
|
 |
006bc1 |
+ if (xo == XO_GROUP3b) emit_i8(as, i8);
|
|
 |
006bc1 |
+ }
|
|
 |
006bc1 |
+ emit_rmro(as, xo, rr, ra, 0);
|
|
 |
006bc1 |
+ emit_loadu64(as, ra, (uintptr_t)addr);
|
|
 |
006bc1 |
} else
|
|
 |
006bc1 |
#endif
|
|
 |
006bc1 |
{
|
|
 |
006bc1 |
--
|
|
 |
006bc1 |
2.20.1
|
|
 |
006bc1 |
|