Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7031385

incorrect register allocation in release_store_fence on linux x86

XMLWordPrintable

    • b12
    • x86
    • linux
    • Not verified

        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'

              dsamersoff Dmitriy Samersoff
              dholmes David Holmes
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: