United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7046893 LP64 problem with double_quadword in c1_LIRAssembler_x86.cpp
JDK-7046893 : LP64 problem with double_quadword in c1_LIRAssembler_x86.cpp

Details
Type:
Bug
Submit Date:
2011-05-20
Status:
Closed
Updated Date:
2011-08-02
Project Name:
JDK
Resolved Date:
2011-06-09
Component:
hotspot
OS:
solaris_10
Sub-Component:
compiler
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
hs21
Fixed Versions:
hs21 (b15)

Related Reports
Backport:
Backport:
Backport:

Sub Tasks

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)));

                                    

Comments
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/ccf072cdba91
                                     
2011-05-25
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot/hotspot/rev/ccf072cdba91
                                     
2011-05-28
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/ccf072cdba91
                                     
2011-06-03
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-rt/hotspot/rev/ccf072cdba91
                                     
2011-06-09



Hardware and Software, Engineered to Work Together