RFR: 8316125: Windows call_stub unnecessarily saves xmm16-31 when UseAVX>=3
Jorn Vernee
jvernee at openjdk.org
Tue Sep 12 23:15:38 UTC 2023
On Tue, 12 Sep 2023 17:10:38 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:
> Please review this patch that removes saving of xmm16-xmm31 registers from Windows call_stub.
>
> Windows ABI only mandates saving xmm6-xmm15, which we continue to do here.
>
> No new tests. Mach5 tier1-5 builds and tests clean.
We've discussed this offline. Based on the calling convention described here: https://learn.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-170#callercallee-saved-registers these registers are 'volatile', i.e. _not_ callee saved. That means that in this case, where we have a C function calling into Java, we don't need to save these registers for our C caller.
The relevant parts behind that link copied here (part bolded by me for emphasis):
> The x64 ABI considers the registers RAX, RCX, RDX, R8, R9, R10, R11, and XMM0-XMM5 volatile. When present, the upper portions of YMM0-YMM15 and ZMM0-ZMM15 are also volatile. **On AVX512VL, the ZMM, YMM, and XMM registers 16-31 are also volatile.** When AMX support is present, the TMM tile registers are volatile. Consider volatile registers destroyed on function calls unless otherwise safety-provable by analysis such as whole program optimization.
>
> The x64 ABI considers registers RBX, RBP, RDI, RSI, RSP, R12, R13, R14, R15, and XMM6-XMM15 nonvolatile. They must be saved and restored by a function that uses them.
-------------
Marked as reviewed by jvernee (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/15688#pullrequestreview-1623346494
PR Comment: https://git.openjdk.org/jdk/pull/15688#issuecomment-1716643255
More information about the hotspot-dev
mailing list