RFR: 8291649: multiple tests failing with -Xcomp after JDK-8290034 [v2]

John R Rose jrose at openjdk.org
Fri Aug 26 01:09:10 UTC 2022


On Fri, 26 Aug 2022 00:44:21 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Jatin Bhateja has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8291649: Review comments resolutions.
>
> src/hotspot/share/utilities/moveBits.hpp line 31:
> 
>> 29: #include "utilities/globalDefinitions.hpp"
>> 30: 
>> 31: inline uint32_t reverse_bits_in_bytes_int(uint32_t x) {
> 
> Instead of two functions with different names (suffixed `_int` and `_long`), have one function name that has two overloads disambiguated by the size of the argument, e.g.
> 
> 
> template<typename T, ENABLE_IF(sizeof(T) <= 4)>
> constexpr T reverse_bits_in_bytes(T x) { ... }
> 
> template<typename T, ENABLE_IF(sizeof(T) == 8)>
> constexpr T reverse_bits_in_bytes(T x) { ... }
> 
> 
> This allows `reverse_bits` to look something like
> 
> 
> template<typename T, ENABLE_IF(std::is_integral<T>::value)>
> constexpr T reverse_bits(T v) {
>   return reverse_bytes(reverse_bits_in_bytes(v));
> }

Yes, that could work.

This also works, and feels appropriately short + sweet to me:

https://github.com/rose00/jdk/pull/new/moveBits

(I also added a 90+% level gtest.)

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

PR: https://git.openjdk.org/jdk/pull/9987


More information about the hotspot-compiler-dev mailing list