# HG changeset patch # User Tom Rodriguez # Date 1426645317 25200 # Node ID f2bdbfe9201b783e21cb3b35f1d21b26eb56a98f # Parent 077c16efeb6ddbd026d866d8ca45d3b909a8cd49 Experimentally disallow Graal compiling itself in tiered diff -r 077c16efeb6d -r f2bdbfe9201b src/share/vm/graal/graalCompiler.cpp --- a/src/share/vm/graal/graalCompiler.cpp Tue Mar 17 19:21:54 2015 -0700 +++ b/src/share/vm/graal/graalCompiler.cpp Tue Mar 17 19:21:57 2015 -0700 @@ -65,6 +65,9 @@ void GraalCompiler::bootstrap() { JavaThread* THREAD = JavaThread::current(); _bootstrapping = true; + // Allow bootstrap to perform Graal compilations of itself + bool c1only = GraalCompileWithC1Only; + GraalCompileWithC1Only = false; ResourceMark rm; HandleMark hm; if (PrintBootstrap) { @@ -105,6 +108,7 @@ if (PrintBootstrap) { tty->print_cr(" in " JLONG_FORMAT " ms (compiled %d methods)", os::javaTimeMillis() - start, _methodsCompiled); } + GraalCompileWithC1Only = c1only; _bootstrapping = false; } diff -r 077c16efeb6d -r f2bdbfe9201b src/share/vm/graal/graalGlobals.hpp --- a/src/share/vm/graal/graalGlobals.hpp Tue Mar 17 19:21:54 2015 -0700 +++ b/src/share/vm/graal/graalGlobals.hpp Tue Mar 17 19:21:57 2015 -0700 @@ -82,6 +82,12 @@ product(bool, GraalHProfEnabled, false, \ "Is Heap Profiler enabled") \ \ + product(bool, GraalCompileWithC1Only, true, \ + "Only compile Graal classes with C1") \ + \ + product(bool, GraalCompileAppFirst, false, \ + "Prioritize application compilations over Graal compilations") \ + \ develop(bool, GraalUseFastLocking, true, \ "Use fast inlined locking code") \ \ diff -r 077c16efeb6d -r f2bdbfe9201b src/share/vm/runtime/advancedThresholdPolicy.cpp --- a/src/share/vm/runtime/advancedThresholdPolicy.cpp Tue Mar 17 19:21:54 2015 -0700 +++ b/src/share/vm/runtime/advancedThresholdPolicy.cpp Tue Mar 17 19:21:57 2015 -0700 @@ -157,6 +157,9 @@ // Called with the queue locked and with at least one element CompileTask* AdvancedThresholdPolicy::select_task(CompileQueue* compile_queue) { +#ifdef COMPILERGRAAL + CompileTask *max_non_graal_task = NULL; +#endif CompileTask *max_task = NULL; Method* max_method = NULL; jlong t = os::javaTimeMillis(); @@ -189,9 +192,30 @@ max_method = method; } } +#ifdef COMPILERGRAAL + if (GraalCompileAppFirst && (task->comp_level() == CompLevel_full_optimization || !method->has_compiled_code()) && + SystemDictionary::graal_loader() != NULL && + method->method_holder()->class_loader() != SystemDictionary::graal_loader()) { + if (max_non_graal_task == NULL) { + max_non_graal_task = task; + } else { + // Select a method with a higher rate + if (compare_methods(method, max_non_graal_task->method())) { + max_non_graal_task = task; + } + } + } +#endif task = next_task; } +#ifdef COMPILERGRAAL + if (max_non_graal_task != NULL) { + max_task = max_non_graal_task; + max_method = max_task->method(); + } +#endif + if (max_task->comp_level() == CompLevel_full_profile && TieredStopAtLevel > CompLevel_full_profile && is_method_profiled(max_method)) { max_task->set_comp_level(CompLevel_limited_profile); diff -r 077c16efeb6d -r f2bdbfe9201b src/share/vm/runtime/simpleThresholdPolicy.inline.hpp --- a/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp Tue Mar 17 19:21:54 2015 -0700 +++ b/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp Tue Mar 17 19:21:57 2015 -0700 @@ -55,6 +55,13 @@ // Determine if a given method is such a case. bool SimpleThresholdPolicy::is_trivial(Method* method) { if (method->is_accessor()) return true; +#ifdef COMPILERGRAAL + if (TieredCompilation && GraalCompileWithC1Only && + SystemDictionary::graal_loader() != NULL && + method->method_holder()->class_loader() == SystemDictionary::graal_loader()) { + return true; + } +#endif if (method->code() != NULL) { MethodData* mdo = method->method_data(); if (mdo != NULL && mdo->num_loops() == 0 &&