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 Oct 2 15:58:56 2015
--- new/src/share/vm/compiler/compileBroker.cpp Fri Oct 2 15:58:56 2015
*** 27,36 ****
--- 27,37 ----
#include "classfile/vmSymbols.hpp"
#include "code/codeCache.hpp"
#include "compiler/compileBroker.hpp"
#include "compiler/compileLog.hpp"
#include "compiler/compilerOracle.hpp"
+ #include "compiler/directivesParser.hpp"
#include "interpreter/linkResolver.hpp"
#include "memory/allocation.inline.hpp"
#include "oops/methodData.hpp"
#include "oops/method.hpp"
#include "oops/oop.inline.hpp"
*** 195,208 ****
--- 196,217 ----
}
};
static CompilationLog* _compilation_log = NULL;
! void compileBroker_init() {
! bool compileBroker_init() {
if (LogEvents) {
_compilation_log = new CompilationLog();
}
+
+ // init directives stack, adding default directive
+ DirectivesStack::init();
+
+ if (DirectivesParser::has_file()) {
+ return DirectivesParser::parse_from_flag();
+ }
+ return true;
}
CompileTaskWrapper::CompileTaskWrapper(CompileTask* task) {
CompilerThread* thread = CompilerThread::current();
thread->set_task(task);
*** 1141,1155 ****
--- 1150,1168 ----
(!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.
bool quietly;
double scale;
! if (CompilerOracle::should_exclude(method, quietly)
|| (CompilerOracle::has_option_value(method, "CompileThresholdScaling", scale) && scale == 0)) {
! if (excluded || (CompilerOracle::has_option_value(method, "CompileThresholdScaling", scale) && scale == 0)) {
+ bool quietly = CompilerOracle::should_exclude_quietly();
if (!quietly) {
// This does not happen quietly...
ResourceMark rm;
tty->print("### Excluding %s:%s",
method->is_native() ? "generation of native wrapper" : "compile",
*** 1309,1319 ****
--- 1322,1331 ----
// Switch back to VM state to do compiler initialization
ThreadInVMfromNative tv(thread);
ResetNoHandleMark rnhm;
if (!comp->is_shark()) {
// Perform per-thread and global initializations
comp->initialize();
}
}
*** 1556,1565 ****
--- 1568,1581 ----
}
ttyLocker ttyl;
tty->print("%s", s.as_string());
}
+ int DirectivesStack::_depth = 0;
+ CompilerDirectives* DirectivesStack::_top = NULL;
+ CompilerDirectives* DirectivesStack::_bottom = NULL;
+
// ------------------------------------------------------------------
// CompileBroker::invoke_compiler_on_method
//
// Compile a method.
//
*** 1582,1601 ****
--- 1598,1621 ----
int osr_bci = task->osr_bci();
bool is_osr = (osr_bci != standard_entry_bci);
bool should_log = (thread->log() != NULL);
bool should_break = false;
int task_level = task->comp_level();
+
+ // Look up matching directives
+ DirectiveSet* directive = DirectivesStack::getMatchingDirective(task->method(), compiler(task_level));
+
+ should_break = directive->BreakAtExecuteOption || task->check_break_at_flags();
+ if (should_log && !directive->LogOption) {
+ should_log = false;
+ }
{
// create the handle inside it's own block so it can't
// accidentally be referenced once the thread transitions to
// native. The NoHandleMark before the transition should catch
// any cases where this occurs in the future.
methodHandle method(thread, task->method());
should_break = check_break_at(method, compile_id, is_osr);
if (should_log && !CompilerOracle::should_log(method)) {
should_log = false;
}
assert(!method->is_native(), "no longer compile natives");
// Save information about this method in case of failure.
set_last_compile(thread, method, is_osr, task_level);
*** 1645,1655 ****
--- 1665,1675 ----
MonitorLockerEx locker(Compilation_lock, Mutex::_no_safepoint_check_flag);
while (WhiteBox::compilation_locked) {
locker.wait(Mutex::_no_safepoint_check_flag);
}
}
! comp->compile_method(&ci_env, target, osr_bci, directive);
}
if (!ci_env.failing() && task->code() == NULL) {
//assert(false, "compiler should always document failure");
// The compiler elected, without comment, not to register a result.
*** 1694,1703 ****
--- 1714,1724 ----
event.set_codeSize((task->code() == NULL) ? 0 : task->code()->total_size());
event.set_inlinedBytes(task->num_inlined_bytecodes());
event.commit();
}
}
+ DirectivesStack::release(directive);
pop_jni_handle_block();
methodHandle method(thread, task->method());
DTRACE_METHOD_COMPILE_END_PROBE(method, compiler_name(task_level), task->is_success());
*** 1879,1903 ****
--- 1900,1909 ----
thread->set_active_handles(java_handles);
compile_handles->set_pop_frame_link(NULL);
JNIHandleBlock::release_block(compile_handles, thread); // may block
}
// ------------------------------------------------------------------
// CompileBroker::check_break_at
//
// Should the compilation break at the current compilation.
bool CompileBroker::check_break_at(methodHandle method, int compile_id, bool is_osr) {
if (CICountOSR && is_osr && (compile_id == CIBreakAtOSR)) {
return true;
} else if( CompilerOracle::should_break_at(method) ) { // break when compiling
return true;
} else {
return (compile_id == CIBreakAt);
}
}
// ------------------------------------------------------------------
// CompileBroker::collect_statistics
//
// Collect statistics about the compilation.
*** 2073,2077 ****
--- 2079,2084 ----
#ifndef PRODUCT
st->print_cr("Compiler thread printing unimplemented.");
st->cr();
#endif
}
+
src/share/vm/compiler/compileBroker.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File