United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6757316 load_constant() produces a wrong long constant, with high a low words swapped
JDK-6757316 : load_constant() produces a wrong long constant, with high a low words swapped

Details
Type:
Bug
Submit Date:
2008-10-08
Status:
Resolved
Updated Date:
2010-12-08
Project Name:
JDK
Resolved Date:
2009-01-31
Component:
hotspot
OS:
generic
Sub-Component:
compiler
CPU:
generic
Priority:
P1
Resolution:
Fixed
Affected Versions:
hs14
Fixed Versions:
hs14 (b09)

Related Reports
Backport:
Backport:
Backport:

Sub Tasks

Description
C1 code generator refers to invalid T_LONG constant in case a similar constant with high and low words swapped is present.

The test case:
  public static void main(String[] args) {
    long[] arr = {
      0x11111111aaaaaaaaL,
      0xaaaaaaaa11111111L,
      0x11111111aaaaaaaaL,
      0xaaaaaaaa11111111L
    };
    System.out.println(Long.toHexString(arr[1]));
  }
The output is wrong (11111111aaaaaaaa) on SPARC and on ARM.

                                    

Comments
SUGGESTED FIX

In c1_LIRGenerator.cpp replace the lines
        if (c->as_jint_hi_bits() != other->as_jint_lo_bits()) continue;
        if (c->as_jint_lo_bits() != other->as_jint_hi_bits()) continue;
with
        if (c->as_jint_lo_bits() != other->as_jint_lo_bits()) continue;
        if (c->as_jint_hi_bits() != other->as_jint_hi_bits()) continue;
                                     
2008-10-08
EVALUATION

The problem was found in LIRGenerator::load_constant(). See comments and suggester fix for details.
                                     
2008-10-17
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot/hotspot/rev/a738a625039a
                                     
2008-12-13



Hardware and Software, Engineered to Work Together