JDK-6757316 : load_constant() produces a wrong long constant, with high a low words swapped
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: hs14
  • Priority: P1
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2008-10-08
  • Updated: 2010-12-08
  • Resolved: 2009-01-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 Other
6u12Fixed 7Fixed hs11Fixed
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
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot/hotspot/rev/a738a625039a
13-12-2008

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

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;
08-10-2008