1 public class test extends Thread {
2 static boolean doit = true;
4 public static void main(String[] argv) {
8 for (int i = 0; i < argv.length; i++) {
9 if (argv[i].equals("--help")) {
12 } else if (argv[i].equals("skip")) {
16 threadcount = Integer.valueOf(argv[i]).intValue();
21 System.out.println("Running with " + threadcount + " threads.");
23 for (int i = 0; i < threadcount; i++) {
29 System.out.println("test [number of threads] [skip]");
56 final private static void invokestatic() {
57 System.out.print("invokestatic: ");
62 System.out.println("OK");
63 } catch (Throwable t) {
64 System.out.println("FAILED: " + t);
69 public void getstatic() {
73 check(getstaticI.i, 123);
76 } catch (Throwable t) {
83 check(getstaticJ.l, 1234567890123L);
86 } catch (Throwable t) {
93 check(getstaticF.f, 123.456F);
96 } catch (Throwable t) {
101 p("getstatic (D): ");
103 check(getstaticD.d, 789.012);
106 } catch (Throwable t) {
111 p("getstatic (L): ");
113 check(getstaticL.o, null);
116 } catch (Throwable t) {
122 public void putstatic() {
124 p("putstatic (I): ");
128 check(putstaticI.i, i);
131 } catch (Throwable t) {
136 p("putstatic (J): ");
138 long l = 1234567890123L;
140 check(putstaticJ.l, l);
143 } catch (Throwable t) {
148 p("putstatic (F): ");
152 check(putstaticF.f, f);
155 } catch (Throwable t) {
160 p("putstatic (D): ");
164 check(putstaticD.d, d);
167 } catch (Throwable t) {
173 p("putstatic (L): ");
177 check(putstaticL.o, o);
180 } catch (Throwable t) {
185 public void getfield() {
189 check(new getfieldI().i, 123);
192 } catch (Throwable t) {
199 check(new getfieldJ().l, 1234567890123L);
202 } catch (Throwable t) {
209 check(new getfieldF().f, 123.456F);
212 } catch (Throwable t) {
219 check(new getfieldD().d, 789.012);
222 } catch (Throwable t) {
229 check(new getfieldL().o, null);
232 } catch (Throwable t) {
238 public void putfield() {
242 putfieldI pfi = new putfieldI();
248 } catch (Throwable t) {
255 putfieldJ pfj = new putfieldJ();
256 long l = 1234567890123L;
261 } catch (Throwable t) {
268 putfieldF pff = new putfieldF();
274 } catch (Throwable t) {
281 putfieldD pfd = new putfieldD();
287 } catch (Throwable t) {
294 putfieldL pfl = new putfieldL();
300 } catch (Throwable t) {
305 public void putfieldconst() {
307 p("putfieldconst (I,F): ");
309 putfieldconstIF pfcif = new putfieldconstIF();
314 } catch (Throwable t) {
319 p("putfieldconst zero (I,F): ");
321 putfieldconstIF pfcif = new putfieldconstIF();
326 } catch (Throwable t) {
331 p("putfieldconst (J,D,L): ");
333 putfieldconstJDL pfcjdl = new putfieldconstJDL();
334 pfcjdl.l = 1234567890123L;
335 check(pfcjdl.l, 1234567890123L);
338 } catch (Throwable t) {
343 p("putfieldconst zero (J,D,L): ");
345 putfieldconstJDL pfcjdl = new putfieldconstJDL();
350 } catch (Throwable t) {
355 private void newarray() {
359 newarray[] na = new newarray[1];
362 } catch (Throwable t) {
367 private void multianewarray() {
369 p("multianewarray: ");
371 multianewarray[][] ma = new multianewarray[1][1];
374 } catch (Throwable t) {
379 public void invokespecial() {
381 p("invokespecial: ");
386 } catch (Throwable t) {
391 private void checkcast() {
392 Object o = new Object();
396 p("checkcast class: ");
398 checkcastC cc = (checkcastC) o;
402 } catch (ClassCastException e) {
404 } catch (Throwable t) {
410 p("checkcast interface: ");
412 checkcastI ci = (checkcastI) o;
416 } catch (ClassCastException e) {
418 } catch (Throwable t) {
425 Object[] oa = new Object[1];
428 p("checkcast class array: ");
430 checkcastC[] cca = (checkcastC[]) oa;
434 } catch (ClassCastException e) {
436 } catch (Throwable t) {
441 private void _instanceof() {
442 Object o = new Object();
445 p("instanceof class: ");
447 if (o instanceof instanceofC)
453 } catch (Throwable t) {
458 p("instanceof interface: ");
460 if (o instanceof instanceofI)
466 } catch (Throwable t) {
473 Object[] oa = new Object[1];
476 p("instanceof class array: ");
478 if (oa instanceof instanceofC[])
484 } catch (Throwable t) {
493 private void failed() {
497 private void failed(Throwable t) {
501 public void check(int a, int b) {
505 pln("FAILED: " + a + " != " + b);
508 public void check(long a, long b) {
512 pln("FAILED: " + a + " != " + b);
515 public void check(float a, float b) {
519 pln("FAILED: " + a + " != " + b);
522 public void check(double a, double b) {
526 pln("FAILED: " + a + " != " + b);
529 public void check(Object a, Object b) {
533 pln("FAILED: " + a + " != " + b);
536 private final void p(String s) {
540 private final void pln(String s) {
541 System.out.println(s);