summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Allsopp <david.allsopp@metastack.com>2023-01-01 15:02:43 +0000
committerDavid Allsopp <david.allsopp@metastack.com>2023-03-14 15:29:19 +0000
commitb15fbb1b9bbf1c08b000173dd8cfa28f7b9af873 (patch)
tree1671ba93ec6ad4475bdb9dea3d5dbd911e216ba8
parentce7a325bb4c1bcc7d0200ef3dc8f2141d7f4bf6f (diff)
downloadocaml-b15fbb1b9bbf1c08b000173dd8cfa28f7b9af873.tar.gz
Fix register metadata for Win64 ABI
rbx is normally preserved in the Win64 ABI (as for Unix), but OCaml 5 uses it to save the OCaml stack pointer for direct (noalloc) calls. The fact rbx is clobbered at C call was incorrectly missing in the Win64 register descriptions.
-rw-r--r--Changes3
-rw-r--r--asmcomp/amd64/proc.ml6
2 files changed, 6 insertions, 3 deletions
diff --git a/Changes b/Changes
index ff889243d3..95a1dbd8d1 100644
--- a/Changes
+++ b/Changes
@@ -619,6 +619,9 @@ Working version
(Jérôme Vouillon, review by Nicolás Ojeda Bär, Stephen Dolan and
Hugo Heuzard)
+- #11846: Mark rbx as destroyed at C call for Win64 (mingw-w64 and Cygwin64).
+ (David Allsopp, review by KC Sivaramakrishnan)
+
- #11850: When stopping before the `emit` phase (using `-stop-after`), an empty
temporary assembly file is no longer left in the file system.
(Nicolás Ojeda Bär, review by Gabriel Scherer and Xavier Leroy)
diff --git a/asmcomp/amd64/proc.ml b/asmcomp/amd64/proc.ml
index 56377b322c..8a46c05f48 100644
--- a/asmcomp/amd64/proc.ml
+++ b/asmcomp/amd64/proc.ml
@@ -291,12 +291,12 @@ let destroyed_at_c_call =
by the code sequence used for C calls in emit.mlp, so it
is marked as destroyed. *)
if win64 then
- (* Win64: rbx, rsi, rdi, r12-r15, xmm6-xmm15 preserved *)
+ (* Win64: rsi, rdi, r12-r15, xmm6-xmm15 preserved *)
Array.of_list(List.map phys_reg
- [0;4;5;6;7;10;11;12;
+ [0;1;4;5;6;7;10;11;12;
100;101;102;103;104;105])
else
- (* Unix: rbx, r12-r15 preserved *)
+ (* Unix: r12-r15 preserved *)
Array.of_list(List.map phys_reg
[0;1;2;3;4;5;6;7;10;11;
100;101;102;103;104;105;106;107;