view c1x4hotspotsrc/HotSpotTest/src/C1XTest.java @ 1433:efba53f86c4f

various fixes and enhancements * correct refmap->oopmap conversion (register numbering, stack slot numbering) * fixes for inlining (correct scoping in exception handler lookup, NPE in scope conversion) * support for "jump to runtime stub" (patching code needs to be aware of jmp instruction) * provide more information about methods (to allow inlining: has_balanced_monitors, etc.) * fixes to signature type lookup * isSubTypeOf: correct handling of array classes * RiType: componentType/arrayOf * prologue: inline cache check, icmiss stub * klass state check (resolved but not initialized) in newinstance * card table write barriers * c1x classes are optional (to allow running c1 without them) * correct for stored frame pointer in calling conventions (methods with arguments on stack) * getType(Class<?>) for some basic types, used for optimizations and folding * RiMethod/RiType: throw exception instead of silent failure on unsupported operations * RiType: resolved/unresolved array type support * refactoring: new on-demand template generation mechanism * optimizations: template specialization for no_null_check, given length, etc.
author Lukas Stadler <lukas.stadler@oracle.com>
date Thu, 16 Sep 2010 19:42:20 -0700
parents 760213a60e8b
children 72cfb36c6bb2
line wrap: on
line source

import java.io.IOException;

public class C1XTest {

	public static long sum = 10;
	
	public static final long value() {
		return sum;
	}
	
	public static void main3(String[] args) {/*
		long s = 0;
		s += value();
		System.out.println(s);*/
	}

	public static void main2(String[] args) {
		Other.I[] array = new Other.I[] { new Other.A(), new Other.B(),
				new Other.C(), new Other.A(), new Other.B(), new Other.C() };

		int sum = 0;
		for (int i = 0; i < 20; i++)
			for (Other.I o : array) {
				sum += o.v();
			}
		System.out.println(sum);
	}

	public static void main(String[] args) throws IOException, Exception {
		for (int i = 0; i < 10000; i++) {
			System.out.print((i & 0xfff) != 0 ? "" : ".");
			test1();
		}
		System.out.println();
		for (int i = 0; i < 100; i++) {
			Thread.sleep(1000);
		}
		for (int i = 0; i < 10000; i++) {
			System.out.print((i & 0xfff) != 0 ? "" : ".");
			test2();
		}
		System.out.println();
		for (int i = 0; i < 100; i++) {
			Thread.sleep(1000);
		}
		for (int i = 0; i < 10000; i++) {
			System.out.print((i & 0xfff) != 0 ? "" : ".");
			test3();
		}
		System.out.println();
		for (int i = 0; i < 100; i++) {
			Thread.sleep(1000);
		}
		for (int i = 0; i < 10000; i++) {
			System.out.print((i & 0xfff) != 0 ? "" : ".");
			test4();
		}
		System.out.println();
		for (int i = 0; i < 100; i++) {
			Thread.sleep(1000);
		}
		for (int i = 0; i < 10000; i++) {
			System.out.print((i & 0xfff) != 0 ? "" : ".");
			test5();
		}
		System.out.println();
		for (int i = 0; i < 100; i++) {
			Thread.sleep(1000);
		}
		for (int i = 0; i < 10000; i++) {
			System.out.print((i & 0xfff) != 0 ? "" : ".");
			test6();
		}
		System.out.println();
		for (int i = 0; i < 100; i++) {
			Thread.sleep(1000);
		}
		for (int i = 0; i < 10000; i++) {
			System.out.print((i & 0xfff) != 0 ? "" : ".");
			test7();
		}
		System.out.println();
		for (int i = 0; i < 100; i++) {
			Thread.sleep(1000);
		}
		for (int i = 0; i < 10000; i++) {
			System.out.print((i & 0xfff) != 0 ? "" : ".");
			test8();
		}
		System.out.println();
		for (int i = 0; i < 10; i++) {
			Thread.sleep(1000);
		}
		System.out.println(sum);
	}

	public static void test1() {
		long t1 = System.nanoTime();
		long t2 = System.nanoTime();
		sum += t2 - t1;
		System.out.print("");
		System.out.print("");
	}

	public static void test2() {
		long t1 = System.nanoTime();
		long t2 = System.nanoTime();
		sum += t2 - t1;
		System.out.print("");
		System.out.print("");
	}

	public static void test3() {
		long t1 = System.nanoTime();
		long t2 = System.nanoTime();
		sum += t2 - t1;
		System.out.print("");
		System.out.print("");
	}

	public static void test4() {
		long t1 = System.nanoTime();
		long t2 = System.nanoTime();
		sum += t2 - t1;
		System.out.print("");
		System.out.print("");
	}

	public static void test5() {
		long t1 = System.nanoTime();
		long t2 = System.nanoTime();
		sum += t2 - t1;
		System.out.print("");
		System.out.print("");
	}

	public static void test6() {
		long t1 = System.nanoTime();
		long t2 = System.nanoTime();
		sum += t2 - t1;
		System.out.print("");
		System.out.print("");
	}

	public static void test7() {
		long t1 = System.nanoTime();
		long t2 = System.nanoTime();
		sum += t2 - t1;
		System.out.print("");
		System.out.print("");
	}

	public static void test8() {
		long t1 = System.nanoTime();
		long t2 = System.nanoTime();
		sum += t2 - t1;
		System.out.print("");
		System.out.print("");
	}

}