JDK-7031385 : incorrect register allocation in release_store_fence on linux x86
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2011-03-26
  • Updated: 2016-02-09
  • Resolved: 2011-05-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 Other
6u115Fixed 7Fixed hs21Fixed
Description
Deepak Bhole reports:

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/
Christian Thalinger reports:

I just stumbled over this same bug on one of our Ubuntu machines using GCC 4.5.1.  What's the status of this fix?

/home/twisti/hotspot-comp/7018355/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp: Assembler messages:
/home/twisti/hotspot-comp/7018355/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp:160: Error: bad register name `%dil'
/home/twisti/hotspot-comp/7018355/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp:160: Error: bad register name `%dil'

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot/hotspot/rev/da880ba4edf9
04-05-2011

EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-rt/hotspot/rev/da880ba4edf9
03-05-2011