[RFR]: 8186578: Zero fails to build on linux-sparc due to sparc-specific code

Andrew Haley aph at redhat.com
Mon Aug 28 10:18:39 UTC 2017

On 28/08/17 11:09, John Paul Adrian Glaubitz wrote:
> On 08/28/2017 11:54 AM, Andrew Haley wrote:
>> It certainly looks like this is wrong.  The execution of memset with concurrent
>> readers while the memory is being zeroed is UB, so we need some kind of special
>> handling in the general case.
> Oh, I'm not saying it's wrong at all.

No, but I am.

> I was just wondering whether it's actually required for performance
> reasons or whether there are other, more fundamental problems
> underlying.
> After talking to Oracle's toolchain guy for Linux SPARC, I now know
> that we cannot glibc's memset in this case, especially not on newer

Right, and we may have similar problems on other targets.

> I'm pretty sure this would work:
>> inline void memset_with_concurrent_readers(void* to, int value, size_t size) {
>>   volatile char *dest = to;
>>   for (int i = 0; i < count; i++)
>>     *dest++ = value;
>> }
>> but its performance would be awful.
> My suggestion would be to move
> memset_with_concurrent_readers_sparc.cpp into a generic place in the
> source tree where it can be used for both the server and the zero
> builds on Linux SPARC.

Do you really have to move it, though?  Can't you #include it from
zero?  It very much is machine-dependent code.

Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671

More information about the hotspot-dev mailing list