Output register allocation constrain fix for HotSpot

Deepak Bhole dbhole at redhat.com
Fri Mar 25 19:59:52 PDT 2011


Hi,

When trying to build IcedTea with GCC 4.6, we encountered an error that
stems from incorrect register allocation in release_store_fence(volatile
jbyte*  p, jbyte  v) in orderAccess_linux_x86.inline.hpp.

Specifically, the inline assembly call trying to do an atomic 8-bit
exchange sets the output register constrain to r. The older versions GCC
(by chance) ended up assigning the l-part of one of the a/b/c/d
registers. However with 4.6, it attempts to do this with the
%*bp register. This is fine on x86_64, but on i686 the bp register
cannot be addressed in 8-bit (%bpl). This leads to a compilation
failure:

/builddir/build/BUILD/icedtea6-1.10/openjdk-ecj/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp: Assembler messages:
/builddir/build/BUILD/icedtea6-1.10/openjdk-ecj/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp:160: Error: bad register name `%bpl'
/builddir/build/BUILD/icedtea6-1.10/openjdk-ecj/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp:160: Error: bad register name `%bpl'

It is possible to make it work on both 32 and 64-bit by constraining the
output register further to only be one of a/b/c/d (=q).

Though it was only that function that caused an error, I think it'd be
best to change both uses of xchgb in orderAccess_linux_x86.inline.hpp to
use =q. Here is the webrev for it:
http://cr.openjdk.java.net/~dbhole/register-allocation-fix/webrev.00/

If there are no issues, I'd be happy to push the above change.

Cheers,
Deepak


More information about the hotspot-dev mailing list