United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7031385 incorrect register allocation in release_store_fence on linux x86
JDK-7031385 : incorrect register allocation in release_store_fence on linux x86

Details
Type:
Bug
Submit Date:
2011-03-26
Status:
Closed
Updated Date:
2011-07-29
Project Name:
JDK
Resolved Date:
2011-05-16
Component:
hotspot
OS:
linux
Sub-Component:
runtime
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
hs21 (b12)

Related Reports
Backport:

Sub Tasks

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-rt/hotspot/rev/da880ba4edf9
                                     
2011-05-03
EVALUATION

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



Hardware and Software, Engineered to Work Together