changeset 12652:0dd597c6c9c7

fixed performance regression in hosted CompileTheWorld
author Doug Simon <doug.simon@oracle.com>
date Fri, 01 Nov 2013 13:07:22 +0100
parents c73b857b1be9
children 1a7e7011a341
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java src/share/vm/classfile/vmSymbols.hpp src/share/vm/graal/graalCompiler.cpp src/share/vm/graal/graalVMToCompiler.cpp src/share/vm/graal/graalVMToCompiler.hpp
diffstat 6 files changed, 32 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java	Fri Nov 01 12:06:22 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java	Fri Nov 01 13:07:22 2013 +0100
@@ -51,6 +51,8 @@
 
     void bootstrap() throws Throwable;
 
+    void compileTheWorld() throws Throwable;
+
     PrintStream log();
 
     JavaMethod createUnresolvedJavaMethod(String name, String signature, JavaType holder);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Fri Nov 01 12:06:22 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Fri Nov 01 13:07:22 2013 +0100
@@ -28,7 +28,6 @@
 import static com.oracle.graal.hotspot.CompilationTask.*;
 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
 import static com.oracle.graal.java.GraphBuilderPhase.*;
-import static com.oracle.graal.phases.GraalOptions.*;
 import static com.oracle.graal.phases.common.InliningUtil.*;
 
 import java.io.*;
@@ -40,7 +39,7 @@
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
-import com.oracle.graal.compiler.CompilerThreadFactory.*;
+import com.oracle.graal.compiler.CompilerThreadFactory.DebugConfigAccess;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.debug.internal.*;
 import com.oracle.graal.graph.*;
@@ -334,11 +333,11 @@
         }
         System.gc();
         phaseTransition("bootstrap2");
+    }
 
-        if (CompileTheWorld.getValue() != null) {
-            new CompileTheWorld().compile();
-            System.exit(0);
-        }
+    public void compileTheWorld() throws Throwable {
+        new CompileTheWorld().compile();
+        System.exit(0);
     }
 
     private MetricRateInPhase parsedBytecodesPerSecond;
--- a/src/share/vm/classfile/vmSymbols.hpp	Fri Nov 01 12:06:22 2013 +0100
+++ b/src/share/vm/classfile/vmSymbols.hpp	Fri Nov 01 13:07:22 2013 +0100
@@ -352,6 +352,7 @@
   template(com_oracle_graal_truffle_GraalTruffleRuntime,             "com/oracle/graal/truffle/GraalTruffleRuntime")                  \
   template(startCompiler_name,                    "startCompiler")                                                                    \
   template(bootstrap_name,                        "bootstrap")                                                                        \
+  template(compileTheWorld_name,                  "compileTheWorld")                                                                  \
   template(shutdownCompiler_name,                 "shutdownCompiler")                                                                 \
   template(compileMethod_name,                    "compileMethod")                                                                    \
   template(compileMethod_signature,               "(JLcom/oracle/graal/hotspot/meta/HotSpotResolvedObjectType;IZ)V")                  \
--- a/src/share/vm/graal/graalCompiler.cpp	Fri Nov 01 12:06:22 2013 +0100
+++ b/src/share/vm/graal/graalCompiler.cpp	Fri Nov 01 13:07:22 2013 +0100
@@ -101,13 +101,20 @@
       bool bootstrap = GRAALVM_ONLY(BootstrapGraal) NOT_GRAALVM(false);
       VMToCompiler::startCompiler(bootstrap);
       _initialized = true;
+      CompilationPolicy::completed_vm_startup();
       if (bootstrap) {
-        // We turn off CompileTheWorld and complete the VM startup so that
-        // Graal can be compiled by C1/C2 when we do a CTW.
-        NOT_PRODUCT(CompileTheWorld = false);
-        CompilationPolicy::completed_vm_startup();
         VMToCompiler::bootstrap();
       }
+
+
+#ifndef PRODUCT
+      if (CompileTheWorld) {
+        // We turn off CompileTheWorld so that Graal can
+        // be compiled by C1/C2 when Graal does a CTW.
+        CompileTheWorld = false;
+        VMToCompiler::compileTheWorld();
+      }
+#endif
     }
   }
 }
--- a/src/share/vm/graal/graalVMToCompiler.cpp	Fri Nov 01 12:06:22 2013 +0100
+++ b/src/share/vm/graal/graalVMToCompiler.cpp	Fri Nov 01 13:07:22 2013 +0100
@@ -162,7 +162,16 @@
   JavaCallArguments args;
   args.push_oop(instance());
   JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::bootstrap_name(), vmSymbols::void_method_signature(), &args, THREAD);
-  check_pending_exception("Error while calling boostrap");
+  check_pending_exception("Error while calling bootstrap");
+}
+
+void VMToCompiler::compileTheWorld() {
+  JavaThread* THREAD = JavaThread::current();
+  JavaValue result(T_VOID);
+  JavaCallArguments args;
+  args.push_oop(instance());
+  JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::compileTheWorld_name(), vmSymbols::void_method_signature(), &args, THREAD);
+  check_pending_exception("Error while calling compileTheWorld");
 }
 
 oop VMToCompiler::createJavaField(Handle holder, Handle name, Handle type, int index, int flags, jboolean internal, TRAPS) {
--- a/src/share/vm/graal/graalVMToCompiler.hpp	Fri Nov 01 12:06:22 2013 +0100
+++ b/src/share/vm/graal/graalVMToCompiler.hpp	Fri Nov 01 13:07:22 2013 +0100
@@ -72,6 +72,9 @@
   // public abstract void bootstrap();
   static void bootstrap();
 
+  // public abstract void compileTheWorld();
+  static void compileTheWorld();
+
   // public abstract JavaField createJavaField(JavaType holder, String name, JavaType type, int flags, int offset);
   static oop createJavaField(Handle holder, Handle name, Handle type, int index, int flags, jboolean internal, TRAPS);