src/share/vm/compiler/compileBroker.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/share/vm/compiler/compileBroker.cpp	Fri Mar 11 14:44:40 2016
--- new/src/share/vm/compiler/compileBroker.cpp	Fri Mar 11 14:44:40 2016

*** 1,7 **** --- 1,7 ---- /* ! * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. ! * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 836,851 **** --- 836,847 ---- int osr_bci, int comp_level, const methodHandle& hot_method, int hot_count, const char* comment, + bool blocking, Thread* thread) { // do nothing if compiler thread(s) is not available if (!_initialized) { return; } guarantee(!method->is_abstract(), "cannot compile abstract methods"); assert(method->method_holder()->is_instance_klass(), "sanity check"); assert(!method->method_holder()->is_not_initialized(), "method holder must be initialized");
*** 914,924 **** --- 910,919 ---- method->get_method_counters(thread); } // Outputs from the following MutexLocker block: CompileTask* task = NULL; bool blocking = false; CompileQueue* queue = compile_queue(comp_level); // Acquire our lock. { MutexLocker locker(MethodCompileQueue_lock, thread);
*** 944,956 **** --- 939,948 ---- if (compile_id == 0) { // The compilation falls outside the allowed range. return; } // Should this thread wait for completion of the compile? blocking = is_compile_blocking(); #if INCLUDE_JVMCI if (UseJVMCICompiler) { if (blocking) { // Don't allow blocking compiles for requests triggered by JVMCI. if (thread->is_Compiler_thread()) {
*** 1032,1046 **** --- 1024,1055 ---- if (blocking) { wait_for_completion(task); } } nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci, int comp_level, const methodHandle& hot_method, int hot_count, const char* comment, Thread* THREAD) { + // do nothing if compilebroker is not available + if (!_initialized) { + return NULL; + } + AbstractCompiler *comp = CompileBroker::compiler(comp_level); + assert(comp != NULL, "Ensure we don't compile before compilebroker init"); + DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, comp); + nmethod* nm = CompileBroker::compile_method(method, osr_bci, comp_level, hot_method, hot_count, comment, directive, THREAD); + DirectivesStack::release(directive); + return nm; + } + + nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci, + int comp_level, + const methodHandle& hot_method, int hot_count, + const char* comment, DirectiveSet* directive, + Thread* THREAD) { + // make sure arguments make sense assert(method->method_holder()->is_instance_klass(), "not an instance method"); assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range"); assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods"); assert(!method->method_holder()->is_not_initialized(), "method holder must be initialized");
*** 1049,1060 **** --- 1058,1069 ---- // return quickly if possible // lock, make sure that the compilation // isn't prohibited in a straightforward way. AbstractCompiler *comp = CompileBroker::compiler(comp_level); ! if (comp == NULL || !comp->can_compile_method(method) || ! compilation_is_prohibited(method, osr_bci, comp_level)) { ! if (!comp->can_compile_method(method) || ! compilation_is_prohibited(method, osr_bci, comp_level, directive->ExcludeOption)) { return NULL; } if (osr_bci == InvocationEntryBci) { // standard compilation
*** 1158,1168 **** --- 1167,1177 ---- // fail out now so blocking compiles dont hang the java thread if (!should_compile_new_jobs()) { CompilationPolicy::policy()->delay_compilation(method()); return NULL; } ! compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, comment, !directive->BackgroundCompilationOption, THREAD); } // return requested nmethod // We accept a higher level osr method if (osr_bci == InvocationEntryBci) {
*** 1215,1225 **** --- 1224,1234 ---- // ------------------------------------------------------------------ // CompileBroker::compilation_is_prohibited // // See if this compilation is not allowed. ! bool CompileBroker::compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level, bool excluded) { bool is_native = method->is_native(); // Some compilers may not support the compilation of natives. AbstractCompiler *comp = compiler(comp_level); if (is_native && (!CICompileNatives || comp == NULL || !comp->supports_native())) {
*** 1233,1247 **** --- 1242,1251 ---- (!CICompileOSR || comp == NULL || !comp->supports_osr())) { method->set_not_osr_compilable(comp_level); return true; } // Breaking the abstraction - directives are only used inside a compilation otherwise. DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, comp); bool excluded = directive->ExcludeOption; DirectivesStack::release(directive); // The method may be explicitly excluded by the user. double scale; if (excluded || (CompilerOracle::has_option_value(method, "CompileThresholdScaling", scale) && scale == 0)) { bool quietly = CompilerOracle::should_exclude_quietly(); if (PrintCompilation && !quietly) {
*** 1302,1321 **** --- 1306,1315 ---- uint CompileBroker::assign_compile_id_unlocked(Thread* thread, const methodHandle& method, int osr_bci) { MutexLocker locker(MethodCompileQueue_lock, thread); return assign_compile_id(method, osr_bci); } /** * Should the current thread block until this compilation request * has been fulfilled? */ bool CompileBroker::is_compile_blocking() { assert(!InstanceRefKlass::owns_pending_list_lock(JavaThread::current()), "possible deadlock"); return !BackgroundCompilation; } // ------------------------------------------------------------------ // CompileBroker::preload_classes void CompileBroker::preload_classes(const methodHandle& method, TRAPS) { // Move this code over from c1_Compiler.cpp ShouldNotReachHere();

src/share/vm/compiler/compileBroker.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File