Beoptimization at a goto or goto_w bytecode may result in incorrect execution or a crash because execution is resumed at the wrong bci. Here's a test case.
public class bw implements Runnable {
public void run() {
for (int i = 0; i < 50; i++) {
try {
System.gc();
Thread.sleep(50);
} catch (Exception e) {
}
}
System.exit(0);
}
static int iters = 10000;
public static void main(String[] args) {
Thread t = new Thread(new bw());
t.start();
test(iters);
}
public static void test(int limit) {
int i = 0;
while (true) {
double f = 32923849234.9;
double f1 = f * f * f;
i++;
}
}
}
Running it as follows will cause a crash:
/usr/local/java/jdk1.4/solsparc/bin/java_g -XX:CompileOnly=bw -Xcomp -XX:+DeoptimizeALot bw
thomas.rodriguez@eng 2001-06-28
public class bw implements Runnable {
public void run() {
for (int i = 0; i < 50; i++) {
try {
System.gc();
Thread.sleep(50);
} catch (Exception e) {
}
}
System.exit(0);
}
static int iters = 10000;
public static void main(String[] args) {
Thread t = new Thread(new bw());
t.start();
test(iters);
}
public static void test(int limit) {
int i = 0;
while (true) {
double f = 32923849234.9;
double f1 = f * f * f;
i++;
}
}
}
Running it as follows will cause a crash:
/usr/local/java/jdk1.4/solsparc/bin/java_g -XX:CompileOnly=bw -Xcomp -XX:+DeoptimizeALot bw
thomas.rodriguez@eng 2001-06-28