diff options
author | David Allsopp <david.allsopp@metastack.com> | 2023-01-01 15:06:32 +0000 |
---|---|---|
committer | David Allsopp <david.allsopp@metastack.com> | 2023-03-15 08:40:50 +0000 |
commit | 340b2a77847472d6aebffb8af9994f1d8c63a215 (patch) | |
tree | c4166e18b7c3f26efaa768d803925e06833a77a8 /Changes | |
parent | b15fbb1b9bbf1c08b000173dd8cfa28f7b9af873 (diff) | |
download | ocaml-340b2a77847472d6aebffb8af9994f1d8c63a215.tar.gz |
Place Win64 ABI shadow store in c_stack_link
The Win64 ABI requires the caller to reserve a fixed 32 bytes of stack
space prior to the call for the function to spill the four argument
registers into (if it chooses).
There are three ways C functions are called by OCaml programs. Under
Windows, two of them were needlessly wasting space reserving this twice
and the third was not reserving it at all.
This implementation capitalises on the fact that OCaml 5 no longer uses
the C stack for OCaml code and so adds the shadow store to the
c_stack_link struct. When in OCaml code, the C stack is therefore left
in exactly the required state to call a C function, which removes the
need for the stack pointer computations from the backend.
Simultaneously, this also fixes a bug, as the shadow store previously
was not being reserved at all when calling noalloc C functions.
Diffstat (limited to 'Changes')
-rw-r--r-- | Changes | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -620,7 +620,12 @@ Working version Hugo Heuzard) - #11846: Mark rbx as destroyed at C call for Win64 (mingw-w64 and Cygwin64). - (David Allsopp, review by KC Sivaramakrishnan) + Reserve the shadow store for the ABI in the c_stack_link struct instead of + explictly when calling C functions. This simultaneously reduces the number of + stack pointer manipulations and also fixes a bug when calling noalloc + functions where the shadow store was not being reserved. + (David Allsopp, report by Vesa Karvonen, review by Xavier Leroy and + 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. |