RFR: 8346107: Generators: testing utility for random value generation

Emanuel Peter epeter at openjdk.org
Wed Dec 18 12:14:38 UTC 2024


On Wed, 18 Dec 2024 07:53:38 GMT, theoweidmannoracle <duke at openjdk.org> wrote:

>> For verification testing, it is often critical to generate "interesting" values, to provoke overflows, NaN, etc. And to generate these values in the correct distribution to trigger certain optimizations.
>> 
>> I would like to start a collection of such generators, that can then be used in testing.
>> 
>> The goal is to grow this collection in the future, and add new types. For example `byte`, `char`, `short`, or even `Float16`.
>> 
>> This will be helpful for the Template framework [JDK-8344942](https://bugs.openjdk.org/browse/JDK-8344942), but also other tests.
>> 
>> Related PR, for value verification: https://github.com/openjdk/jdk/pull/22715
>
> test/hotspot/jtreg/compiler/lib/generators/DoubleGenerator.java line 31:
> 
>> 29: 
>> 30: /**
>> 31:  * Define interface of double generators.
> 
> More nitpicking: I would omit "define", also below.

done

> test/hotspot/jtreg/compiler/lib/generators/IntGenerator.java line 56:
> 
>> 54:      */
>> 55:     public void fill(MemorySegment ms, int lo, int hi) {
>> 56:         for (long i = 0; i < ms.byteSize() / 4; i++ ) {
> 
> Suggestion:
> 
>         for (long i = 0; i < ms.byteSize() / 4; i++) {

done

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22716#discussion_r1890136068
PR Review Comment: https://git.openjdk.org/jdk/pull/22716#discussion_r1890135634


More information about the hotspot-compiler-dev mailing list