RFR (S) 8217639: Minimal and Zero builds fail after JDK-8217519 (Improve RegMask population count calculation)

Vladimir Kozlov vladimir.kozlov at oracle.com
Wed Jan 23 16:57:41 UTC 2019


Good. I think it is trivial.

thanks,
Vladimir

On 1/23/19 8:50 AM, Aleksey Shipilev wrote:
> Bug:
>    https://bugs.openjdk.java.net/browse/JDK-8217639
> 
> Reason: New test references "extern uint8_t byte[] bitsInByte", and that is defined in
> libadt/vectset.cpp, which is not compiled when C2 is disabled in Minimal and Zero VM builds. I was
> first considering to enabled libadt build when C2 is disabled, but the more straight-forward fix
> would be to give the test its own golden data to test against. This would also implicitly test for
> accidental bugs in bitsInByte matrix in production code.
> 
> Fix:
> 
> diff -r c96f9aa1f3d8 -r 29037fc5194d test/hotspot/gtest/utilities/test_population_count.cpp
> --- a/test/hotspot/gtest/utilities/test_population_count.cpp    Wed Jan 23 13:16:16 2019 +0000
> +++ b/test/hotspot/gtest/utilities/test_population_count.cpp    Wed Jan 23 17:04:25 2019 +0100
> @@ -29,18 +29,35 @@
>   #include "utilities/globalDefinitions.hpp"
>   #include "unittest.hpp"
> 
> +uint8_t test_popcnt_bitsInByte[BITS_IN_BYTE_ARRAY_SIZE] = {
> +        0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
> +        1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
> +        1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
> +        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
> +        1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
> +        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
> +        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
> +        3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
> +        1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
> +        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
> +        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
> +        3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
> +        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
> +        3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
> +        3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
> +        4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
> +};
> 
>   TEST(population_count, sparse) {
> -  extern uint8_t bitsInByte[BITS_IN_BYTE_ARRAY_SIZE];
>     // Step through the entire input range from a random starting point,
>     // verify population_count return values against the lookup table
>     // approach used historically
>     uint32_t step = 4711;
>     for (uint32_t value = os::random() % step; value < UINT_MAX - step; value += step) {
> -    uint32_t lookup = bitsInByte[(value >> 24) & 0xff] +
> -                      bitsInByte[(value >> 16) & 0xff] +
> -                      bitsInByte[(value >> 8)  & 0xff] +
> -                      bitsInByte[ value        & 0xff];
> +    uint32_t lookup = test_popcnt_bitsInByte[(value >> 24) & 0xff] +
> +                      test_popcnt_bitsInByte[(value >> 16) & 0xff] +
> +                      test_popcnt_bitsInByte[(value >> 8)  & 0xff] +
> +                      test_popcnt_bitsInByte[ value        & 0xff];
> 
>       EXPECT_EQ(lookup, population_count(value))
>           << "value = " << value;
> 
> Testing: Linux x86_64 {server,zero,minimal} build and gtest:population_count
> 
> -Aleksey
> 


More information about the hotspot-compiler-dev mailing list