RFR (S) 8238289: Use _byteswap_ functions to implement Bytes::swap_uX on Windows

David Holmes david.holmes at oracle.com
Sun Apr 5 23:55:04 UTC 2020


Hi Ralf,

On 3/04/2020 6:40 pm, Schmelter, Ralf wrote:
> Hi,
> 
> can you please review this change. It uses the VS compiler intrinsics to implement byte order swapping for 16, 32 and 64 bit types. For most other platforms we already used the platform specific calls to do this.
> 
> bugreport: https://bugs.openjdk.java.net/browse/JDK-8238289
> webrev: http://cr.openjdk.java.net/~rschmelter/webrevs/8238289/webrev.0/

On the surface this looks good.

My only concern is that the docs for those functions seem incorrect:

https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/byteswap-uint64-byteswap-ulong-byteswap-ushort?view=vs-2019

They are described as "Reverses the order of bytes in an integer." but 
then has the examples:

byteswap of 102030405060708 = 807060504030201
byteswap of 1020304 = 4030201

which is not byte swapping! ???

Cheers,
David

> As a consequence of this change the size of the server.dll increased by ~ 7kB for a release build. This was not expected, since the code needed for a implementation of the byte swap calls itself was much smaller now. In the end I've traced it down to more inlining being done in the JFR code.
> 
> Best regards,
> Ralf
> 


More information about the hotspot-runtime-dev mailing list