For JDK-8208390 a workaround to avoid miscompilation with the current Solaris/SPARC compiler has been added, inlining some MAX2/MIN2 macros in WorkerDataArray<T>::print_summary_on.
I.e.
for (uint i = start; i < _length; ++i) {
T value = get(i);
if (value != uninitialized()) {
max = MAX2(max, value);
min = MIN2(min, value);
sum = add(sum, value);
contributing_threads++;
}
}
had to be turned to
for (uint i = start; i < _length; ++i) {
T value = get(i);
if (value != uninitialized()) {
if (max < value) { max = value; }
if (min > value) { min = value; }
sum = add(sum, value);
contributing_threads++;
}
}
Failing gtest without this change on Solaris/SPARC are the
UninitializedTicks(pan)ElementWorkerDataArrayTest.print_summary_on_test_test_vm test with the following error without the change:
./open/test/hotspot/gtest/gc/shared/test_workerDataArray.cpp:356: Failure
Expected equality of these values:
print_expected_summary()
Which is: "Test array Min: 5.1, Avg: 6.1, Max: 7.2, Diff: 2.1, Workers: 2\n"
print_summary()
Which is: "Test array Min: 5.1, Avg: 6.1, Max: 5.1, Diff: 0.0, Workers: 2\n"
I.e. MAX2 is not correctly evaluated in both debug and product builds.
Re-evaluate this change if/when the compiler changes.