changeset 16108:1a6746681b43

Merge.
author Doug Simon <doug.simon@oracle.com>
date Fri, 13 Jun 2014 18:44:55 +0200
parents c7db9dc73694 (diff) 99e2e006ade2 (current diff)
children ed7a88f43dc3
files
diffstat 4 files changed, 27 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Fri Jun 13 18:19:58 2014 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Fri Jun 13 18:44:55 2014 +0200
@@ -63,6 +63,7 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.graal.printer.*;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
@@ -490,21 +491,31 @@
     }
 
     /**
-     * Entry point for the VM to schedule a compilation for a metaspace Method.
+     * Schedules compilation of a metaspace Method.
      *
      * Called from the VM.
      */
     @SuppressWarnings("unused")
     private static void compileMetaspaceMethod(long metaspaceMethod, final int entryBCI, long ctask, final boolean blocking) {
-        final HotSpotResolvedJavaMethod method = HotSpotResolvedJavaMethod.fromMetaspace(metaspaceMethod);
         if (ctask != 0L) {
+            // Ensure a Graal runtime is initialized prior to Debug being initialized as the former
+            // may include processing command line options used by the latter.
+            Graal.getRuntime();
+
+            // Ensure a debug configuration for this thread is initialized
+            if (Debug.isEnabled() && DebugScope.getConfig() == null) {
+                DebugEnvironment.initialize(System.out);
+            }
+
             // This is on a VM CompilerThread - no user frames exist
+            final HotSpotResolvedJavaMethod method = HotSpotResolvedJavaMethod.fromMetaspace(metaspaceMethod);
             compileMethod(method, entryBCI, ctask, false);
         } else {
             // We have to use a privileged action here because compilations are
             // enqueued from user code which very likely contains unprivileged frames.
             AccessController.doPrivileged(new PrivilegedAction<Void>() {
                 public Void run() {
+                    final HotSpotResolvedJavaMethod method = HotSpotResolvedJavaMethod.fromMetaspace(metaspaceMethod);
                     compileMethod(method, entryBCI, 0L, blocking);
                     return null;
                 }
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java	Fri Jun 13 18:19:58 2014 +0200
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java	Fri Jun 13 18:44:55 2014 +0200
@@ -37,7 +37,7 @@
     public static GraalDebugConfig initialize(PrintStream log) {
 
         // Ensure Graal runtime is initialized prior to Debug being initialized as the former
-        // included processing command line options used by the latter.
+        // may include processing command line options used by the latter.
         Graal.getRuntime();
 
         if (!Debug.isEnabled()) {
--- a/src/share/vm/graal/graalCompiler.cpp	Fri Jun 13 18:19:58 2014 +0200
+++ b/src/share/vm/graal/graalCompiler.cpp	Fri Jun 13 18:44:55 2014 +0200
@@ -138,6 +138,7 @@
       return;
   }
 
+  HandleMark hm;
   ResourceMark rm;
   JavaValue result(T_VOID);
   JavaCallArguments args;
--- a/src/share/vm/runtime/advancedThresholdPolicy.cpp	Fri Jun 13 18:19:58 2014 +0200
+++ b/src/share/vm/runtime/advancedThresholdPolicy.cpp	Fri Jun 13 18:44:55 2014 +0200
@@ -345,6 +345,17 @@
       if (common(p, method, CompLevel_full_profile, disable_feedback) == CompLevel_full_optimization) {
         next_level = CompLevel_full_optimization;
       } else if ((this->*p)(i, b, cur_level)) {
+#ifdef COMPILERGRAAL
+        // Since Graal takes a while to warm up, its queue inevitably backs up during
+        // early VM execution. As of 2014-06-13, Graal's inliner assumes that the root
+        // compilation method and all potential inlinees have mature profiles (which
+        // includes type profiling). If it sees immature profiles, Graal's inliner
+        // can perform pathologically bad (e.g., causing OutOfMemoryErrors due to
+        // exploring/inlining too many graphs). Since a rewrite of the inliner is
+        // in progress, we simply disable the dialing back heuristic for now and will
+        // revisit this decision once the new inliner is completed.
+        next_level = CompLevel_full_profile;
+#else
         // C1-generated fully profiled code is about 30% slower than the limited profile
         // code that has only invocation and backedge counters. The observation is that
         // if C2 queue is large enough we can spend too much time in the fully profiled code
@@ -358,6 +369,7 @@
         } else {
           next_level = CompLevel_full_profile;
         }
+#endif
       }
       break;
     case CompLevel_limited_profile: