United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7039586 test/java/util/Collections/Rotate.java failing with hs21-b09
JDK-7039586 : test/java/util/Collections/Rotate.java failing with hs21-b09

Details
Type:
Bug
Submit Date:
2011-04-26
Status:
Closed
Updated Date:
2011-07-29
Project Name:
JDK
Resolved Date:
2011-05-10
Component:
hotspot
OS:
generic
Sub-Component:
compiler
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
hs21 (b11)

Related Reports
Backport:
Relates:

Sub Tasks

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

                                    

Comments
EVALUATION

Caused by changes for 7004535: Clone loop predicate during loop unswitch.
                                     
2011-04-26
EVALUATION

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

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

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



Hardware and Software, Engineered to Work Together