JDK-4962416 : Server Compiler Crash in parser
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.6
  • CPU: sparc
  • Submitted: 2003-12-02
  • Updated: 2005-07-11
  • Resolved: 2005-07-11
Related Reports
Duplicate :  
Description

Name: ks84122			Date: 12/02/2003


The below testcase when run with the debug version of java with CompilerNullChecks off would cause an assert in the server compiler.

cat  > SieveBits.java << \!
class BitSet
{       int P[];
        int K;
        public BitSet (int k)
        {       P=new int[k/32+1]; K=k;
        }
        synchronized public void set (int i)
        {       if (i<0) throw new ArrayIndexOutOfBoundsException("");
                P[i>>5]|=(1<<(i&0x0000001F));
        }
        synchronized public void clear (int i)
        {       P[i>>5]&=~(1<<(i&0x0000001F));
        }
        synchronized public boolean get (int i)
        {       return (P[i>>5]&(1<<(i&0x0000001F)))!=0;
        }
        public int size ()
        {       return K;
        }
}
        
        
/* Sieve.java
Das Primzahlsieb f?r Java.
*/

public class SieveBits
{       static BitSet prime;
        // Enthaelt Flags fuer die ungeraden Zahlen:
   // 3,5,7,...
   // D.h., 2*i+3 ist prim, wenn prime[i] war ist
   
        static public void main (String args[])
    // Hauptprogramm
    {   int n;
                if (args.length==0) n=100000000;
                // falls keine Argumente in der Kommandozeile
                else n=Integer.parseInt(args[0]);
                // lies Anzahl aus der Kommandozeile
                int k=(n-3)/2;
                System.out.println("Counting primes up to "+(2*k+3)+".");
                long time=System.currentTimeMillis();
                prime=new BitSet(k);
        sieve(); // das Sieb
                // Zaehle gefundene Primzahlen:
                int count=1,i;
                for (i=0; i<k; i++)
                        if (prime.get(i)) count++;
                // Ausgabe:
                time=System.currentTimeMillis()-time;
                System.out.println(count+" primes found.");
                System.out.println(time/1000+" seconds needed");
                // list(); // nur fuer Testzwecke
        }
   
        static void sieve ()
        // das Sieb
        {       int k=prime.size(),i,j,p,l;
                // Zuerst alle Zahlen auf prim setzen
                for (i=0; i<k; i++) prime.set(i);
                // Dann Vielfache von Primzahlen aussieben
                for (i=0; i<k; i++)
                {
                        if (prime.get(i)) // 2*i+3 ist prim
                        {       p=2*i+3;
                                l=(p*p-3)/2;
                                if (l>k) break;
                                for (j=l; j<k; j+=p) prime.clear(j);
                                // streicht p*p,p*(p+2), etc.
                        }
                }
        }

}
!

/opt/jdk1.4.2/bin/java_g  -server -XX:-GenerateCompilerNullChecks SieveBits
VM option '-GenerateCompilerNullChecks'
Counting primes up to 99999999.
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/parse3.cpp:80
#
# HotSpot Virtual Machine Error, assertion failure
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
#
# Java VM: Java HotSpot(TM) Server VM (1.4.2-b28-debug mixed mode)
#
# assert(_gvn.type(obj)->higher_equal(tjp), "cast_up is no longer needed")
#
# Error ID: /export1/jdk/jdk1.4.2/hotspot/src/share/vm/opto/parse3.cpp, 80 [ Patched ]
#
# Problematic Thread: prio=5 tid=0x00120780 nid=0xa runnable
#

Heap at VM Abort:
Heap
 def new generation   total 2112K, used 0K [0xf0800000, 0xf0a20000, 0xf1d50000)
  eden space 2048K,   0% used [0xf0800000, 0xf0800000, 0xf0a00000)
  from space 64K,   0% used [0xf0a10000, 0xf0a10000, 0xf0a20000)
  to   space 64K,   0% used [0xf0a00000, 0xf0a00000, 0xf0a10000)
 tenured generation   total 7512K, used 6186K [0xf1d50000, 0xf24a6000, 0xf4800000)
   the space 7512K,  82% used [0xf1d50000, 0xf235a948, 0xf235aa00, 0xf24a6000)
 compacting perm gen  total 16384K, used 1043K [0xf4800000, 0xf5800000, 0xf8800000)
   the space 16384K,   6% used [0xf4800000, 0xf4904f18, 0xf4905000, 0xf5800000)
Dumping core....
Abort (core dumped)
(Incident Review ID: 228797) 
======================================================================

Comments
SUGGESTED FIX See evaluation. This fix was put in 1.5 (Tiger) as part of a larger fix of 4292742. ###@###.### 2005-07-11 21:21:48 GMT
11-07-2005

EVALUATION Confirmed with latest Tiger bits. But the bug is not significant - it will not be fixed in beta. ###@###.### 2003-12-03 This flag is an internal developer feature, not intended for customer use. It is occasionally used for certain kinds of performance test, but by developers only. Any developer who wants to use this flag must assume responsibility for ensuring that it works. In other words, this is a self-service feature. I'm downgrading the priority to reflect the nature of this. Not marking "will not fix" because the failure may possibly mark a bug in the system. (But it probably doesn't.) Also, it would be nice to make this work right. But customer-visible features must take priority. ###@###.### 2003-12-03 To make the assert go away, we need to tweak the type to look non-null. The fix probably looks like this: - if( !GenerateCompilerNullChecks ) return value; + if (!GenerateCompilerNullChecks && !assert_null) + return cast_not_null(value); // Make it look non-null. ###@###.### 2003-12-22
22-12-2003