# HG changeset patch # User Doug Simon # Date 1402908258 -7200 # Node ID 0c0bc9ce40f2f931220d774092f52c6e945a2ea5 # Parent ed7a88f43dc3929be56fe5e8f6654069ef329bad# Parent 26d95e1247d045b38abcb4c3fd3eae60724b8e2b Merge. diff -r 26d95e1247d0 -r 0c0bc9ce40f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Fri Jun 13 15:19:12 2014 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Mon Jun 16 10:44:18 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() { public Void run() { + final HotSpotResolvedJavaMethod method = HotSpotResolvedJavaMethod.fromMetaspace(metaspaceMethod); compileMethod(method, entryBCI, 0L, blocking); return null; } diff -r 26d95e1247d0 -r 0c0bc9ce40f2 graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java Fri Jun 13 15:19:12 2014 -0700 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java Mon Jun 16 10:44:18 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()) { diff -r 26d95e1247d0 -r 0c0bc9ce40f2 src/share/vm/graal/graalCompiler.cpp --- a/src/share/vm/graal/graalCompiler.cpp Fri Jun 13 15:19:12 2014 -0700 +++ b/src/share/vm/graal/graalCompiler.cpp Mon Jun 16 10:44:18 2014 +0200 @@ -138,6 +138,7 @@ return; } + HandleMark hm; ResourceMark rm; JavaValue result(T_VOID); JavaCallArguments args; diff -r 26d95e1247d0 -r 0c0bc9ce40f2 src/share/vm/runtime/advancedThresholdPolicy.cpp --- a/src/share/vm/runtime/advancedThresholdPolicy.cpp Fri Jun 13 15:19:12 2014 -0700 +++ b/src/share/vm/runtime/advancedThresholdPolicy.cpp Mon Jun 16 10:44:18 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: