JDK-7039586 : test/java/util/Collections/Rotate.java failing with hs21-b09
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 7
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-04-26
  • Updated: 2011-07-29
  • Resolved: 2011-05-10
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 7 Other
7Fixed hs21Fixed
Related Reports
Relates :  
The jdk regression test java/util/Collections/Rotate.java has started failing in jdk7-b139 (hs21-b09). jdk7-b138 (hs21-b08) is okay. The failure can also be reproduced by copying hs21-b09 server/libjvm.so into a b138 image. Duplicates on serveral platforms, including linux-i586 and solaris-sparc. Doesn't duplicate with client VM.

The test is in the jdk repository but duplicated here as it is short and standalone.

import java.util.*;

public class Rotate {
    // Should have lots of distinct factors and be > ROTATE_THRESHOLD
    static final int SIZE = 120;

    static Random rnd = new Random();

    public static void main(String[] args) throws Exception {
        List a[] = {new ArrayList(), new LinkedList(), new Vector()};

        for (int i=0; i<a.length; i++) {
            List lst = a[i];
            for (int j=0; j<SIZE; j++)
                lst.add(new Integer(j));
            int totalDist = 0;

            for (int j=0; j<10000; j++) {
                int dist = rnd.nextInt(200) - 100;
                Collections.rotate(lst, dist);

                // Check that things are as they should be
                totalDist = (totalDist + dist) % SIZE;
                if (totalDist < 0)
                    totalDist += SIZE;
                int index =0;
                for (int k=totalDist; k<SIZE; k++, index++)
                    if (((Integer)lst.get(k)).intValue() != index)
                        throw new Exception("j: "+j+", lst["+k+"]="+lst.get(k)+
                                            ", should be "+index);
                for (int k=0; k<totalDist; k++, index++)
                    if (((Integer)lst.get(k)).intValue() != index)
                        throw new Exception("j: "+j+", lst["+k+"]="+lst.get(k)+
                                            ", should be "+index);

EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-rt/hotspot/rev/273b56978029

EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/273b56978029

EVALUATION A predicate should not be moved in partial peel optimization since it will invalidate jvm state of its uncommon trap.

EVALUATION Caused by changes for 7004535: Clone loop predicate during loop unswitch.