[PATCH] openjdk/zero: only use FPU opcodes if FPU is available

Andrew Haley aph at redhat.com
Wed Jun 23 05:32:07 PDT 2010


On 06/23/2010 09:29 AM, Gary Benson wrote:
> Sebastian Andrzej Siewior wrote:
>> * Gary Benson | 2010-06-22 09:47:51 [+0100]:
>>> I'm happy with this patch if it allows Zero to build where it
>>> otherwise wouldn't, but be aware that without this code or
>>> some equivalent it will not be possible to pass the TCK with
>>> the build.
>>
>> I've built the code with this patch and I saw no further
>> problems. Can you please describe what you mean by " it will not be
>> possible to pass the TCK with the build" ?  It looks to me that it
>> is just an optimization on s390 and powerpc (with FPU). Other
>> Architectures like arm or mips are treated the same way.
> 
> The TCK is the set of tests that checks whether or not a JVM is
> compatible with a specific version of Java.
> 
> This little piece of assembler is there because the Java Language
> Specification [1] states that reads and writes of volatile long and
> volatile double fields must be atomic.  If you remove that bit of
> code then what you build does not conform to the spec.  It will
> work without it, but it's not certifyable.  The reason ARM and
> 32-bit MIPS don't have that piece of assembler is that nobody has
> tried to certify them yet so nobody has written that piece of
> assembler for those platforms.
> 
> Basically, if you just want to run stuff then it's ok to bypass
> that piece of assembler, but if you want to certify the builds
> for whatever reason then you will need to figure out some other
> way to do a 64-bit atomic copy.

Which is pretty easy:

static void atomic_copy64(volatile void *src, volatile void *dst) {
  pthread_mutex_lock(&the_mutex);
  *dst = *src;
  pthread_mutex_unlock(&the_mutex);
}

... assuming that's the only place volatile doubles are ever touched.

Andrew.


More information about the jdk6-dev mailing list