summaryrefslogtreecommitdiff
path: root/rts/StgCRun.c
diff options
context:
space:
mode:
authorklebinger.andreas@gmx.at <klebinger.andreas@gmx.at>2018-01-31 21:39:19 -0500
committerBen Gamari <ben@smart-cactus.org>2018-01-31 23:29:30 -0500
commitadd4e1f11b88cd603f6c01bc135eb576e1922a8e (patch)
tree78f3a89dedf01891c350b6a53bc013551ee66340 /rts/StgCRun.c
parent382c12d18f3d64e01502a5c8bbc64d4aa4842e3e (diff)
downloadhaskell-add4e1f11b88cd603f6c01bc135eb576e1922a8e.tar.gz
Mark xmm6 as caller saved in the register allocator for windows.
This prevents the register being picked up as a scratch register. Otherwise the allocator would be free to use it before a call. This fixes #14619. Test Plan: ci, repro case on #14619 Reviewers: bgamari, Phyx, erikd, simonmar, RyanGlScott, simonpj Reviewed By: Phyx, RyanGlScott, simonpj Subscribers: simonpj, RyanGlScott, Phyx, rwbarton, thomie, carter GHC Trac Issues: #14619 Differential Revision: https://phabricator.haskell.org/D4348
Diffstat (limited to 'rts/StgCRun.c')
-rw-r--r--rts/StgCRun.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/rts/StgCRun.c b/rts/StgCRun.c
index 5460598ced..ab66c649fc 100644
--- a/rts/StgCRun.c
+++ b/rts/StgCRun.c
@@ -236,7 +236,7 @@ StgRunIsImplementedInAssembler(void)
);
}
-#endif
+#endif // defined(i386_HOST_ARCH)
/* ----------------------------------------------------------------------------
x86-64 is almost the same as plain x86.
@@ -279,9 +279,23 @@ StgRunIsImplementedInAssembler(void)
"movq %%r14,32(%%rax)\n\t"
"movq %%r15,40(%%rax)\n\t"
#if defined(mingw32_HOST_OS)
+ /*
+ * Additional callee saved registers on Win64. This must match
+ * callClobberedRegisters in compiler/nativeGen/X86/Regs.hs as
+ * both represent the Win64 calling convention.
+ */
"movq %%rdi,48(%%rax)\n\t"
"movq %%rsi,56(%%rax)\n\t"
- "movq %%xmm6,64(%%rax)\n\t"
+ "movq %%xmm6, 64(%%rax)\n\t"
+ "movq %%xmm7, 72(%%rax)\n\t"
+ "movq %%xmm8, 80(%%rax)\n\t"
+ "movq %%xmm9, 88(%%rax)\n\t"
+ "movq %%xmm10, 96(%%rax)\n\t"
+ "movq %%xmm11,104(%%rax)\n\t"
+ "movq %%xmm12,112(%%rax)\n\t"
+ "movq %%xmm13,120(%%rax)\n\t"
+ "movq %%xmm14,128(%%rax)\n\t"
+ "movq %%xmm15,136(%%rax)\n\t"
#endif
/*
* Set BaseReg
@@ -317,9 +331,18 @@ StgRunIsImplementedInAssembler(void)
"movq 32(%%rsp),%%r14\n\t"
"movq 40(%%rsp),%%r15\n\t"
#if defined(mingw32_HOST_OS)
- "movq 48(%%rsp),%%rdi\n\t"
- "movq 56(%%rsp),%%rsi\n\t"
- "movq 64(%%rsp),%%xmm6\n\t"
+ "movq 48(%%rsp),%%rdi\n\t"
+ "movq 56(%%rsp),%%rsi\n\t"
+ "movq 64(%%rsp),%%xmm6\n\t"
+ "movq 72(%%rax),%%xmm7\n\t"
+ "movq 80(%%rax),%%xmm8\n\t"
+ "movq 88(%%rax),%%xmm9\n\t"
+ "movq 96(%%rax),%%xmm10\n\t"
+ "movq 104(%%rax),%%xmm11\n\t"
+ "movq 112(%%rax),%%xmm12\n\t"
+ "movq 120(%%rax),%%xmm13\n\t"
+ "movq 128(%%rax),%%xmm14\n\t"
+ "movq 136(%%rax),%%xmm15\n\t"
#endif
"addq %1, %%rsp\n\t"
"retq"