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

LP64 problem with double_quadword in c1_LIRAssembler_x86.cpp

    XMLWordPrintable

Details

    • b15
    • x86
    • solaris_10
    • Verified

    Backports

      Description

        When running a 64-bit JVM on Windows 7, the JVM.dll failed to load due to an exception in the following code. Since long is a 32-bit integer, the casts in the operand calculation have the effect of truncating a 64-bit address to 32 bits and then sign-extending it. The casts should be to intptr_t, not long.
         
        I encountered this in JDK 7 build 130, but the source code is the same in build 142
         
        In hotspot\src\cpu\x86\vm\c1_LIRAssembler_x86.cpp:
         
        // Note: 'double' and 'long long' have 32-bits alignment on x86.
        static jlong* double_quadword(jlong *adr, jlong lo, jlong hi) {
          // Use the expression (adr)&(~0xF) to provide 128-bits aligned address
          // of 128-bits operands for SSE instructions.
          jlong *operand = (jlong*)(((long)adr)&((long)(~0xF)));
          // Store the value to a 128-bits operand.
          operand[0] = lo;
          operand[1] = hi;
          return operand;
        }
         
         
        The corrected statement would be:
          jlong *operand = (jlong*)(((intptr_t)adr)&((intptr_t)(~0xF)));

        Attachments

          Issue Links

            Activity

              People

                iveresov Igor Veresov
                never Tom Rodriguez
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: