-
Bug
-
Resolution: Won't Fix
-
P3
-
None
-
1.2.0
-
x86
-
windows_nt
Name: akC45999 Date: 05/18/98
The following test counts calls of a recursive method
until StackOverflowError occur.
It shows for jdk12beta4f with jit:
a) stack size of child thread is too small,
so only 873 calls are possible.
b) stack size of main thread is surprisingly large.
For jdk12beta4f without jit, stack sizes are equal.
------------------------------ file recur.java
public class Recur {
volatile int count=0;
synchronized double recur(double arg) {
count++;
// hack to avoid optimization of tail recursion
if (arg>0) return recur(Math.sin(arg))+arg;
else return recur(Math.cos(arg))*arg;
}
public static void main(String args[]) {
Recur rec=new Recur();
try{
rec.recur(1.0);
System.exit(rec.count);
} catch (StackOverflowError e) {
System.out.println("count="+rec.count);
}
}
}
------------------------------ end of file recur.java
novo64% which java
/export/ld14/java/dest/jdk1.2b4F/solaris/bin/java
novo64% java Recur
StackOverflowError
recur count=58204
StackOverflowError
recur count=873
novo64% setenv JAVA_COMPILER NULL
novo64% java Recur
Warning: JIT compiler "NULL" not found. Will use interpreter.
StackOverflowError
recur count=7747
StackOverflowError
recur count=7748
Note, jdk12beta3 behaves fine:
novo64% which java
/export/ld14/java/dest/jdk1.2b3A/solaris/bin/java
novo64% java Recur
StackOverflowError
recur count=7748
StackOverflowError
recur count=7748
======================================================================
Name: akC45999 Date: 06/15/98
The originally submited test file file recur.java was wrong.
The right test is:
------------------------------ file Recur.java
public class Recur implements Runnable {
volatile int count=0;
int rez;
synchronized int recur(int arg) {
count++;
// hack to avoid optimization of tail recursion
return recur((arg*arg*count+777)%count);
}
public void run() {
try{
rez=recur(1);
} catch (StackOverflowError e) {
}
}
public static void main(String args[]) throws Exception {
Recur rec=new Recur();
rec.run();
System.out.println("main count="+rec.count);
rec=new Recur();
Thread child=new Thread(rec);
child.start();
child.join();
System.out.println("child count="+rec.count);
}
}
------------------------------ end of file Recur.java
I have no jdk1.2beta4F to rerun the test now, and jdk1.2beta4G
and jdk1.2beta4H (with JIT) both dump core while running this test.
Should I submit new bug report?
======================================================================
- relates to
-
JDK-4235574 Intermittent JCK failure in cricket
- Closed