RFR: 8283327: Add methods to save/restore registers when calling into the VM from C1/interpreter barrier code/improve push pop stuff for x86

Thomas Schatzl tschatzl at openjdk.java.net
Fri Mar 18 17:42:34 UTC 2022


On Fri, 18 Mar 2022 17:35:17 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> In the x64 Windows ABI xmm0-5 and xmm16-31 are volatile, i.e. caller save. That's why, unlike in the SysV ABI, xmm6-15 are not in the set, and hence not saved by the caller.
>> 
>> The code says: if we have more than 16 xmm registers (AVX), then add xmm16 to 31 to the set of caller saved registers.
>> If we added xmm16 to 31 unconditionally, the code generator would complain that xmm16 to 31 are not available with e.g. SSE2 only.
>> 
>> Here's the relevant part of the spec:
>> 
>>> 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. Consider volatile registers destroyed on function calls unless otherwise safety-provable by analysis such as whole program optimization.
>> 
>> 
>> Thomas
>
> If you look below for the SysV ABI, in the '#else' part, the code unconditionally adds all xmm registers that are available:
> 
> 
> XMMRegSet::range(xmm0, as_XMMRegister(FrameMap::get_num_caller_save_xmms() - 1));
> 
> If you want we can do the same for Win64 if you think this is better.

Of course, if C1 never uses xmm >= 8, then I can limit the number of register saving.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7867


More information about the hotspot-dev mailing list