RFR: 8350988: Consolidate Identity of self-inverse operations [v3]

Hannes Greule hgreule at openjdk.org
Thu Mar 13 14:00:27 UTC 2025


On Thu, 13 Mar 2025 13:20:57 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Good catch, I'm using Generators now. I'm currently not testing ReverseBytesS/US, but there also isn't support for short/char in Generators. Should I still add tests?
>
> You can always restrict ranges:
> 
> private static final RestrictableGenerator<Integer> GEN_BYTE = Generators.G.safeRestrict(Generators.G.ints(), Byte.MIN_VALUE, Byte.MAX_VALUE);
> private static final RestrictableGenerator<Integer> GEN_CHAR = Generators.G.safeRestrict(Generators.G.ints(), Character.MIN_VALUE, Character.MAX_VALUE);
> private static final RestrictableGenerator<Integer> GEN_SHORT = Generators.G.safeRestrict(Generators.G.ints(), Short.MIN_VALUE, Short.MAX_VALUE);
> private static final RestrictableGenerator<Integer> GEN_INT = Generators.G.ints();
> private static final RestrictableGenerator<Long> GEN_LONG = Generators.G.longs();
> private static final Generator<Float> GEN_FLOAT = Generators.G.floats();
> private static final Generator<Double> GEN_DOUBLE = Generators.G.doubles();
> private static final RestrictableGenerator<Integer> GEN_BOOLEAN = Generators.G.safeRestrict(Generators.G.ints(), 0, 1);
> 
> 
>> I'm currently not testing ReverseBytesS/US, but there also isn't support for short/char in Generators. Should I still add tests?
> 
> And yes, more tests would always be better.

Thanks, I added test cases for short and char. Interestingly, there are no reverse (bits) methods for those types.

Please let me know if there's anything more I can do.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23851#discussion_r1993587660


More information about the hotspot-compiler-dev mailing list