On 12/27/2016 07:56 AM, Uros Bizjak wrote:
Hello!
According to the Microsoft 64-bit ABI specification, registers RDI, RSI and
XMM6-15 are
non-volatile and the stack alignment is 16 bytes. In practice, the Windows
implementation
appears to not be so picky about the 16-byte alignment requirement, probably
because it never
to save SSE registers and instead just never uses them. This led to a large list
(https://bugs.winehq.org/show_bug.cgi?id=27680) of Win64 programs violating the
ABI with
impunity, but crashing in Wine until force_align_arg_pointer was added to gcc
and used in Wine.
Stack re-alignment was originally done prior to int register saves, but was
moved to after SSE
saves in 2010 to better facilitate parallelization, and for simplicity's sake,
the stack pointer was
considered invalid after stack re-alignment and SSE movs were emitted unaligned
relative to the
frame pointer. But now that forced stack re-alignment is the new normal for
Wine64, it means that
it always gets the unaligned movs in Wine. This patch set fixes the problem
while preserving the
improved parallelization of int register saves of Richard Henderson's patch in
2010.
I have looked briefly through the patchset, and the approach looks good to me.
However, this patch is touching somehow delicate part of the compiler,
where lots of code-paths cross each other (and we have had quite some
hard-to-fix bugs in this area).
IMO, the patch is not appropriate for inclusion at the current stage
of the compiler development, and should wait for early stage 1. Please
resubmit it later for inclusion.
Thanks,
Uros.
Thank you for the review. Yes, this is a very delicate code path indeed.
For the purposes of the 64-bit Microsoft ABI function calling a System V
function, I've written a fairly exhaustive test program (although
probably not fully comprehensive) for testing pro/epilogues under
various conditions. I'm completely new to dejagnu however, so I still
need to figure out how to properly integrate it. Maybe when I re-submit
this patch set I can submit the new tests with it.
Thanks,
Daniel