----------- normal exceptions --------------------
-throw new Exception(): OK
+normal exceptions-----------------------------------------
+
+throw new Exception(): OK
java.lang.Exception
- at extest.main(extest.java:24)
+ at extest.main(extest.java:26)
-throw new Exception() (from subroutines): OK
+throw new Exception() (from subroutines): OK
java.lang.Exception
- at extest.sub4(extest.java:392)
- at extest.sub3(extest.java:388)
- at extest.sub2(extest.java:384)
- at extest.sub(extest.java:380)
- at extest.main(extest.java:38)
+ at extest.sub4(extest.java:299)
+ at extest.sub3(extest.java:295)
+ at extest.sub2(extest.java:291)
+ at extest.sub(extest.java:287)
+ at extest.main(extest.java:40)
-NullPointerException: OK
+NullPointerException: OK
java.lang.NullPointerException
- at extest.main(extest.java:48)
+ at extest.main(extest.java:50)
----------- test soft inline exceptions ----------
-/* thrown twice to check the inline jump code */
-ArithmeticException (only w/ -softnull): OK
-java.lang.ArithmeticException: / by zero
- at extest.main(extest.java:63)
+exceptions thrown in JIT code-----------------------------
-ArithmeticException (only w/ -softnull): OK
+ArithmeticException (only w/ -softnull): OK
java.lang.ArithmeticException: / by zero
- at extest.main(extest.java:79)
+ at extest.main(extest.java:64)
-ArrayIndexOutOfBoundsException: OK
+ArrayIndexOutOfBoundsException: OK
java.lang.ArrayIndexOutOfBoundsException: -889275714
- at extest.main(extest.java:97)
-
-ArrayIndexOutOfBoundsException: OK
-java.lang.ArrayIndexOutOfBoundsException: -1161901314
- at extest.main(extest.java:114)
+ at extest.main(extest.java:81)
-ArrayStoreException: OK
+ArrayStoreException: OK
java.lang.ArrayStoreException
- at extest.main(extest.java:133)
+ at extest.main(extest.java:99)
-ArrayStoreException: OK
-java.lang.ArrayStoreException
- at extest.main(extest.java:144)
-
-ClassCastException: OK
+ClassCastException: OK
java.lang.ClassCastException: java/lang/Object
- at extest.main(extest.java:155)
+ at extest.main(extest.java:109)
-ClassCastException: OK
-java.lang.ClassCastException: java/lang/Object
- at extest.main(extest.java:166)
-
-NegativeArraySizeException (newarray): OK
-java.lang.NegativeArraySizeException
- at extest.main(extest.java:176)
-
-NegativeArraySizeException (newarray): OK
+NegativeArraySizeException (newarray): OK
java.lang.NegativeArraySizeException
- at extest.main(extest.java:185)
+ at extest.main(extest.java:118)
-NegativeArraySizeException (multianewarray): OK
+NegativeArraySizeException (multianewarray): OK
java.lang.NegativeArraySizeException
- at extest.main(extest.java:194)
-
-NullPointerException (only w/ -softnull): OK
-java.lang.NullPointerException
- at extest.main(extest.java:205)
+ at extest.main(extest.java:127)
-NullPointerException (only w/ -softnull): OK
-java.lang.NullPointerException
- at extest.main(extest.java:215)
-
-OutOfMemoryError: OK
+OutOfMemoryError: OK
java.lang.OutOfMemoryError
- at extest.main(extest.java:225)
+ at extest.main(extest.java:137)
-OutOfMemoryError: OK
+OutOfMemoryError (multianewarray): OK
java.lang.OutOfMemoryError
- at extest.main(extest.java:235)
+ at extest.main(extest.java:146)
-OutOfMemoryError (multianewarray): OK
-java.lang.OutOfMemoryError
- at extest.main(extest.java:244)
+exceptions in leaf functions------------------------------
----------- exceptions in leaf functions ---------
-ArithmeticException: OK
+ArithmeticException: OK
java.lang.ArithmeticException: / by zero
- at extest.aesub(extest.java:396)
- at extest.main(extest.java:258)
+ at extest.aesub(extest.java:303)
+ at extest.main(extest.java:160)
-ArrayIndexOutOfBoundsException: OK
+ArrayIndexOutOfBoundsException: OK
java.lang.ArrayIndexOutOfBoundsException: -559038737
- at extest.aioobesub(extest.java:400)
- at extest.main(extest.java:267)
+ at extest.aioobesub(extest.java:307)
+ at extest.main(extest.java:169)
-ClassCastException: OK
+ClassCastException: OK
java.lang.ClassCastException: java/lang/Object
- at extest.ccesub(extest.java:404)
- at extest.main(extest.java:284)
+ at extest.ccesub(extest.java:311)
+ at extest.main(extest.java:186)
-NullPointerException: OK
+NullPointerException: OK
java.lang.NullPointerException
- at extest.npesub(extest.java:408)
- at extest.main(extest.java:293)
+ at extest.npesub(extest.java:315)
+ at extest.main(extest.java:195)
+
+Exception in <clinit> triggered from a leaf method: OK
+java.lang.ExceptionInInitializerError
+ at extest.main(extest.java:204)
+Caused by: java.lang.NullPointerException
+ at extest_clinit_patcher.<clinit>(extest.java:374)
+ at extest.main(extest.java:204)
+
+exception related things----------------------------------
----------- exception related things -------------
-load/link an exception class in asmpart: OK
+load/link an exception class in asmpart: OK
java.lang.Exception
- at extest.main(extest.java:307)
+ at extest.main(extest.java:218)
+
+native stub exceptions------------------------------------
----------- native stub exceptions ---------------
-NullPointerException in <clinit>: OK
+NullPointerException in <clinit>: OK
java.lang.ExceptionInInitializerError
- at extest.main(extest.java:323)
+ at extest.main(extest.java:234)
Caused by: java.lang.NullPointerException
- at extest_clinit.<clinit>(extest_clinit.java:4)
- at extest.main(extest.java:323)
+ at extest_clinit.<clinit>(extest.java:363)
+ at extest.main(extest.java:234)
-UnsatisfiedLinkError: OK
+UnsatisfiedLinkError: OK
java.lang.UnsatisfiedLinkError: nsub
- at extest.nsub(Native Method)
- at extest.main(extest.java:336)
+ at extest.main(extest.java:243)
-NullPointerException (native): OK
+NullPointerException (native): OK
java.lang.NullPointerException
- at java.lang.System.arraycopy(System.java:281)
- at extest.main(extest.java:345)
+ at java.lang.System.arraycopy(System.java:297)
+ at extest.main(extest.java:252)
----------- special exceptions -------------------
-OutOfMemoryError (array clone): OK
+special exceptions----------------------------------------
+
+OutOfMemoryError (array clone): OK
java.lang.OutOfMemoryError
at [B.clone(Native Method)
- at extest.main(extest.java:361)
+ at extest.main(extest.java:268)
+
+exception thrown to command-line--------------------------
----------- no OK beyond this point --------------
NullPointerException (without catch):
Exception in thread "main" java.lang.NullPointerException
- at extest.main(extest.java:375)
+ at extest.main(extest.java:282)
public class extest {
+ final static int COLUMN = 55;
+
final static int INDEX1 = 0xcafebabe;
final static int INDEX2 = 0xbabecafe;
final static int INDEX3 = 0xdeadbeef;
// if (argv[0].equals("stacktrace"))
// printStackTrace = true;
- boolean catched = false;
+ boolean caught = false;
- pln("---------- normal exceptions --------------------");
+ pheader("normal exceptions");
try {
p("throw new Exception():");
throw new Exception();
} catch (Exception e) {
- catched = true;
+ caught = true;
ok();
pstacktrace(e);
} finally {
/* check if catch block was executed */
- if (!catched) {
+ if (!caught) {
failed();
}
}
pln();
- pln("---------- test soft inline exceptions ----------");
- pln("/* thrown twice to check the inline jump code */");
+ pheader("exceptions thrown in JIT code");
try {
p("ArithmeticException (only w/ -softnull):");
}
}
- try {
- p("ArithmeticException (only w/ -softnull):");
- long i = 1, j = 0, k = i / j;
- failed();
- } catch (ArithmeticException e) {
- String msg = e.getMessage();
-
- if (msg == null || !msg.equals("/ by zero")) {
- pln("FAILED: wrong message: " + msg + ", should be: / by zero");
-
- } else {
- ok();
- pstacktrace(e);
- }
- }
-
-
try {
p("ArrayIndexOutOfBoundsException:");
int[] ia = new int[1];
}
}
- try {
- p("ArrayIndexOutOfBoundsException:");
- int[] ia = new int[1];
- ia[INDEX2] = 1;
- failed();
- } catch (ArrayIndexOutOfBoundsException e) {
- String msg = e.getMessage();
-
- if (msg == null || !msg.equals(String.valueOf(INDEX2))) {
- pln("FAILED: wrong index: " + msg + ", should be: " + INDEX2);
- pstacktrace(e);
- } else {
- ok();
- pstacktrace(e);
- }
- }
-
-
try {
p("ArrayStoreException:");
Integer[] ia = new Integer[1];
pstacktrace(e);
}
- try {
- p("ArrayStoreException:");
- Integer[] ia = new Integer[1];
- Object[] oa = (Object[]) ia;
- oa[0] = new Object();
- failed();
- } catch (ArrayStoreException e) {
- ok();
- pstacktrace(e);
- }
-
-
try {
p("ClassCastException:");
Object o = new Object();
pstacktrace(e);
}
- try {
- p("ClassCastException:");
- Object o = new Object();
- Integer i = null;
- i = (Integer) o;
- failed();
- } catch (ClassCastException e) {
- ok();
- pstacktrace(e);
- }
-
-
- try {
- p("NegativeArraySizeException (newarray):");
- int[] ia = new int[-1];
- failed();
- } catch (NegativeArraySizeException e) {
- ok();
- pstacktrace(e);
- }
-
try {
p("NegativeArraySizeException (newarray):");
int[] ia = new int[-1];
pstacktrace(e);
}
-
- try {
- p("NullPointerException (only w/ -softnull):");
- int[] ia = null;
- int i = ia.length;
- failed();
- } catch (NullPointerException e) {
- ok();
- pstacktrace(e);
- }
-
- try {
- p("NullPointerException (only w/ -softnull):");
- int[] ia = null;
- int i = ia.length;
- failed();
- } catch (NullPointerException e) {
- ok();
- pstacktrace(e);
- }
-
try {
p("OutOfMemoryError:");
/* use twice the heap size */
pstacktrace(e);
}
- try {
- p("OutOfMemoryError:");
- /* use twice the heap size */
- byte[] ba = new byte[maxmem * 2];
- failed();
- } catch (OutOfMemoryError e) {
- ok();
- pstacktrace(e);
- }
-
try {
p("OutOfMemoryError (multianewarray):");
byte[][] ba = new byte[maxmem][maxmem];
pln();
- pln("---------- exceptions in leaf functions ---------");
+ pheader("exceptions in leaf functions");
try {
p("ArithmeticException:");
pstacktrace(e);
}
+ try {
+ p("Exception in <clinit> triggered from a leaf method:");
+ extest_clinit_patcher.i = 1;
+ failed();
+ } catch (ExceptionInInitializerError e) {
+ ok();
+ pstacktrace(e);
+ }
+
pln();
- pln("---------- exception related things -------------");
+ pheader("exception related things");
try {
p("load/link an exception class in asmpart:");
pln();
- pln("---------- native stub exceptions ---------------");
+ pheader("native stub exceptions");
try {
p("NullPointerException in <clinit>:");
} catch (ExceptionInInitializerError e) {
ok();
pstacktrace(e);
- } catch (UnsatisfiedLinkError e) {
- /* catch this one for ENABLE_STATICVM and say it's ok */
- ok();
- pstacktrace(e);
}
try {
pln();
- pln("---------- special exceptions -------------------");
+ pheader("special exceptions");
try {
p("OutOfMemoryError (array clone):");
pln();
- pln("---------- no OK beyond this point --------------");
+ pheader("exception thrown to command-line");
pln("NullPointerException (without catch):");
String s = null;
static void p(String s) {
System.out.print(s);
- for (int i = s.length(); i < 46; i++) {
+ for (int i = s.length(); i < COLUMN; i++) {
System.out.print(" ");
}
}
+ static void pheader(String s) {
+ System.out.print(s);
+ for (int i = s.length(); i < COLUMN + 3; i++) {
+ System.out.print("-");
+ }
+ System.out.println();
+ System.out.println();
+ }
+
static void pln() {
System.out.println();
}
System.out.println();
}
}
+
+class extest_clinit {
+ static {
+ String s = null;
+ s.length();
+ }
+
+ public static native void sub();
+}
+
+class extest_clinit_patcher {
+ static int i;
+
+ static {
+ int[] ia = null;
+ int a = ia.length;
+ }
+}