changeset 1438:a7a0ef3c6858

Added timing printout on VM shutdown.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Mon, 25 Oct 2010 18:35:34 +0200
parents 9e5e83ca2259
children d0c8d3a2a7e8
files c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/Compiler.java c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotXirGenerator.java c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMExitsNative.java c1x4hotspotsrc/hotspot/hotspot SciMark.launch c1x4hotspotsrc/hotspot/hotspot jtt.launch src/share/vm/c1x/c1x_CodeInstaller.cpp
diffstat 6 files changed, 26 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/Compiler.java	Mon Oct 25 16:47:52 2010 +0200
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/Compiler.java	Mon Oct 25 18:35:34 2010 +0200
@@ -44,12 +44,24 @@
     public static Compiler getInstance() {
         if (theInstance == null) {
             theInstance = new Compiler();
+            Runtime.getRuntime().addShutdownHook(new ShutdownThread());
         }
         return theInstance;
     }
 
     private static VMEntries vmEntries;
 
+
+    public static class ShutdownThread extends Thread {
+        @Override
+        public void run() {
+            VMExitsNative.compileMethods = false;
+            if (C1XOptions.PrintTimers) {
+                C1XTimers.print();
+            }
+        }
+    }
+
     public static VMExits initializeServer(VMEntries entries) {
         if (Logger.ENABLED) {
             vmEntries = LoggingProxy.getProxy(VMEntries.class, entries);
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotXirGenerator.java	Mon Oct 25 16:47:52 2010 +0200
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotXirGenerator.java	Mon Oct 25 18:35:34 2010 +0200
@@ -255,7 +255,7 @@
 
             // -- out of line -------------------------------------------------------
             asm.bindOutOfLine(stub);
-            XirOperand method = asm.createRegister("method", CiKind.Word, AMD64.rbx);
+            XirOperand method = asm.createRegister("method", CiKind.Object, AMD64.rbx);
             asm.mark(MARK_STATIC_CALL_STUB, XirMark.CALLSITE);
             asm.mov(method, asm.w(0L));
             XirLabel dummy = asm.createOutOfLineLabel("dummy");
@@ -278,7 +278,7 @@
 
             // -- out of line -------------------------------------------------------
             asm.bindOutOfLine(stub);
-            XirOperand method = asm.createRegister("method", CiKind.Word, AMD64.rbx);
+            XirOperand method = asm.createRegister("method", CiKind.Object, AMD64.rbx);
             asm.mark(MARK_STATIC_CALL_STUB, XirMark.CALLSITE);
             asm.mov(method, asm.w(0L));
             XirLabel dummy = asm.createOutOfLineLabel("dummy");
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMExitsNative.java	Mon Oct 25 16:47:52 2010 +0200
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMExitsNative.java	Mon Oct 25 18:35:34 2010 +0200
@@ -36,6 +36,8 @@
  */
 public class VMExitsNative implements VMExits {
 
+    public static boolean compileMethods = true;
+
     @Override
     public boolean setOption(String option) {
         if (option.length() == 0) {
@@ -100,6 +102,11 @@
 
     @Override
     public void compileMethod(long methodVmId, String name, int entryBCI) {
+
+        if (!compileMethods) {
+            return;
+        }
+
         try {
             Compiler compiler = Compiler.getInstance();
             HotSpotMethodResolved riMethod = new HotSpotMethodResolved(methodVmId, name);
@@ -118,6 +125,7 @@
             t.printStackTrace(new PrintWriter(out));
             Logger.info("Compilation interrupted:\n" + out.toString());
         }
+        System.gc();
     }
 
     @Override
--- a/c1x4hotspotsrc/hotspot/hotspot SciMark.launch	Mon Oct 25 16:47:52 2010 +0200
+++ b/c1x4hotspotsrc/hotspot/hotspot SciMark.launch	Mon Oct 25 18:35:34 2010 +0200
@@ -15,7 +15,7 @@
 <stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
 <booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
 <stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
-<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="-client -XX:+UseC1X -XX:+PrintGC -Xms1g -Xmx1g -Xbootclasspath/p:${workspace_loc:hotspot}/../../../maxine/C1X/bin:${workspace_loc:hotspot}/../../../maxine/CRI/bin:${workspace_loc:hotspot}/../../../maxine/Base/bin:${workspace_loc:hotspot}/../../../maxine/Assembler/bin:${workspace_loc:hotspot}/../HotSpotVM/bin -classpath &quot;/home/tw/Benchmarks/scimark/&quot; -C1X:+PrintCompilation -C1X:+PrintTimers jnt.scimark2.commandline"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="-client -XX:+UseC1X -XX:+PrintGC -Xms1g -Xmx1g -Xbootclasspath/p:${workspace_loc:hotspot}/../../../maxine/C1X/bin:${workspace_loc:hotspot}/../../../maxine/CRI/bin:${workspace_loc:hotspot}/../../../maxine/Base/bin:${workspace_loc:hotspot}/../../../maxine/Assembler/bin:${workspace_loc:hotspot}/../HotSpotVM/bin -Xbootclasspath/a:/home/tw/Benchmarks/scimark/ -classpath &quot;/home/tw/Benchmarks/scimark&quot; -C1X:+PrintCompilation -XX:+BackgroundCompilation -C1X:-PrintAssembly -C1X:+PrintTimers jnt.scimark2.commandline"/>
 <stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="/home/tw/Projects/jre1.7.0/bin/java"/>
 <stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="hotspot"/>
 <stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.solaris.base.945602881"/>
--- a/c1x4hotspotsrc/hotspot/hotspot jtt.launch	Mon Oct 25 16:47:52 2010 +0200
+++ b/c1x4hotspotsrc/hotspot/hotspot jtt.launch	Mon Oct 25 18:35:34 2010 +0200
@@ -2,7 +2,7 @@
 <launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
 <intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
 <stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
-<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="-client -XX:+UseC1X -Xcomp -XX:CompileOnly=jtt -XX:+PrintCompilation -Xbootclasspath/p:${workspace_loc:hotspot}/../../../maxine/C1X/bin:${workspace_loc:hotspot}/../../../maxine/CRI/bin:${workspace_loc:hotspot}/../../../maxine/Base/bin:${workspace_loc:hotspot}/../../../maxine/Assembler/bin:${workspace_loc:hotspot}/../HotSpotVM/bin -classpath ${workspace_loc:hotspot}/../../../maxine/VM/bin:${workspace_loc:hotspot}/../HotSpotTest/bin JavaTester 570"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="-client -XX:+UseC1X -Xcomp -XX:CompileOnly=jtt -XX:+PrintCompilation -Xbootclasspath/p:${workspace_loc:hotspot}/../../../maxine/C1X/bin:${workspace_loc:hotspot}/../../../maxine/CRI/bin:${workspace_loc:hotspot}/../../../maxine/Base/bin:${workspace_loc:hotspot}/../../../maxine/Assembler/bin:${workspace_loc:hotspot}/../HotSpotVM/bin -classpath ${workspace_loc:hotspot}/../../../maxine/VM/bin:${workspace_loc:hotspot}/../HotSpotTest/bin -C1X:+PrintCompilation JavaTester 575"/>
 <stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="/home/tw/Projects/jre1.7.0/bin/java"/>
 <stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="hotspot"/>
 <stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.solaris.base.945602881"/>
--- a/src/share/vm/c1x/c1x_CodeInstaller.cpp	Mon Oct 25 16:47:52 2010 +0200
+++ b/src/share/vm/c1x/c1x_CodeInstaller.cpp	Mon Oct 25 18:35:34 2010 +0200
@@ -28,9 +28,9 @@
 
 // TODO this should be handled in a more robust way - not hard coded...
 Register CPU_REGS[] = { rax, rbx, rcx, rdx, rsi, rdi, r8, r9, r11, r12, r13, r14 };
-const static int NUM_CPU_REGS = 10;
+const static int NUM_CPU_REGS = sizeof(CPU_REGS) / sizeof(Register);
 XMMRegister XMM_REGS[] = { xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15 };
-const static int NUM_XMM_REGS = 16;
+const static int NUM_XMM_REGS = sizeof(XMM_REGS) / sizeof(XMMRegister);
 const static int NUM_REGS = NUM_CPU_REGS + NUM_XMM_REGS;
 
 // convert c1x register indices (as used in oop maps) to hotspot registers