JDK-4707800 : crash when using volatile field and when SQE runs CompileTheWorld admswt10.jar
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 1.4.1
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_7
  • CPU: sparc
  • Submitted: 2002-06-25
  • Updated: 2002-07-22
  • Resolved: 2002-07-15
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.
Other
1.4.1 rcFixed
Related Reports
Relates :  
Description
This test causes crash when used with -server. If I remove the volatile keyword from the checksum field then the crash does not occur. Happens on winNT. I
attached the input file that I used when I saw this occur.

import java.io.*;

public class Blah {

    static final int ITERATIONS = 60000;

    public static void main(String [] args) throws Exception {
        for (int x=0; x<10; x++) {
            test1(false);
            test2(false);
            test3(false);
        }
        test1(true);
        test2(true);
        test3(true);
    }

    volatile static long checksum = 0;

    private static void test1(boolean reportResult) throws Exception {
        FileInputStream fis = new FileInputStream("inputfile");
        FileOutputStream fos = new FileOutputStream("outputfile");

        DataInputStream dis = new DataInputStream(new BufferedInputStream(fis));
        DataOutputStream dos=new DataOutputStream(newBufferedOutputStream(fos));

        long check = 0;
        long startTime = System.currentTimeMillis();
        for (int x=0; x<ITERATIONS; x++) {
            short s = dis.readShort();
            dos.writeShort(s);
            check += s;
        }
        long endTime = System.currentTimeMillis();
        long totalTime = endTime - startTime;
        if (reportResult)
            reportResult("readShort", "milliseconds", totalTime);

        dis.close();
        dos.close();
        checksum = check;
        return;
    }

    private static void test2(boolean reportResult) throws Exception {
        FileInputStream fis = new FileInputStream("inputfile");
        FileOutputStream fos = new FileOutputStream("outputfile");

        DataInputStream dis = new DataInputStream(new BufferedInputStream(fis));
        DataOutputStream dos=new DataOutputStream(newBufferedOutputStream(fos));

        long check = 0;
        long startTime = System.currentTimeMillis();
        for (int x=0; x<ITERATIONS; x++) {
            int s = dis.readInt();
            s = dis.readInt();
            dos.writeInt(s);
            dos.writeInt(s);
            check += s;
        }
        long endTime = System.currentTimeMillis();
        long totalTime = endTime - startTime;
        if (reportResult)
            reportResult("readInt", "milliseconds", totalTime);

        dis.close();
        dos.close();
        checksum = check;
        return;
    }

    private static void test3(boolean reportResult) throws Exception {
        FileInputStream fis = new FileInputStream("inputfile");
        FileOutputStream fos = new FileOutputStream("outputfile");

        DataInputStream dis = new DataInputStream(new BufferedInputStream(fis));
        DataOutputStream dos=new DataOutputStream(newBufferedOutputStream(fos));

        long check = 0;
        long startTime = System.currentTimeMillis();
        for (int x=0; x<ITERATIONS; x++) {
            long s = dis.readLong(); s = dis.readLong();
            dos.writeLong(s); dos.writeLong(s);
            check += s;
        }
        dos.flush();

        long endTime = System.currentTimeMillis();
        long totalTime = endTime - startTime;
        if (reportResult)
            reportResult("readLong", "milliseconds", totalTime);

        dis.close();
        dos.close();
        checksum = check;
        return;
    }

    private static void reportResult(String label, String unit, long result) {
        StringBuffer message = new StringBuffer(100);
        message.append(label + " completed in " + result + " " + unit);
        System.err.println(message);
    }
}

-----

###@###.### 2002-06-26

I observed the same crash with CompileTheWorld of admswt10.jar on windows-i386:
java_g -hopper_baseline -Xbatch -Xss4m -XX:+CompileTheWorld -XX:MinInliningThreshold=0 -Xbootclasspath/p:admswt10.jar

SQE, Francis Hsu, confirmed that the current hopper candidate crashes when 
running CompileTheWorld on admswt10.jar with solaris-i386.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: hopper-rc FIXED IN: hopper-rc INTEGRATED IN: hopper-rc VERIFIED IN: hopper-rc
14-06-2004

EVALUATION ###@###.### 2002-06-26 The allocator crashes when it sees the following internal code sequence and incorrectly assumes that the storeSSL instruction is also a MachSpillCopy 5981 loadConL0 <== 1 << 5982 5983 >> #0 5983 MachSpillCopy <== _ 5981 << 6047 4974 >> 408 storeSSL <== _ 5983 << 407 >> -----
11-06-2004

SUGGESTED FIX ###@###.### 2002-06-26 Before executing the following code at reg_split.cpp line 1119 check: > if (n->is_SpillCopy() != NULL) { Node *spill = new MachSpillCopyNode(use,use_rm,def_rm); n->set_req(copyidx,spill); n->is_SpillCopy()->set_in_RegMask(def_rm); ^ current code hits NULL
11-06-2004