1043 }
1044 AbstractCompiler *comp = CompileBroker::compiler(comp_level);
1045 assert(comp != NULL, "Ensure we don't compile before compilebroker init");
1046 DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, comp);
1047 nmethod* nm = CompileBroker::compile_method(method, osr_bci, comp_level, hot_method, hot_count, comment, directive, THREAD);
1048 DirectivesStack::release(directive);
1049 return nm;
1050 }
1051
1052 nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
1053 int comp_level,
1054 const methodHandle& hot_method, int hot_count,
1055 const char* comment, DirectiveSet* directive,
1056 Thread* THREAD) {
1057
1058 // make sure arguments make sense
1059 assert(method->method_holder()->is_instance_klass(), "not an instance method");
1060 assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range");
1061 assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods");
1062 assert(!method->method_holder()->is_not_initialized(), "method holder must be initialized");
1063 // allow any levels for WhiteBox
1064 assert(WhiteBoxAPI || TieredCompilation || comp_level == CompLevel_highest_tier, "only CompLevel_highest_tier must be used in non-tiered");
1065 // return quickly if possible
1066
1067 // lock, make sure that the compilation
1068 // isn't prohibited in a straightforward way.
1069 AbstractCompiler *comp = CompileBroker::compiler(comp_level);
1070 if (!comp->can_compile_method(method) ||
1071 compilation_is_prohibited(method, osr_bci, comp_level, directive->ExcludeOption)) {
1072 return NULL;
1073 }
1074
1075 if (osr_bci == InvocationEntryBci) {
1076 // standard compilation
1077 nmethod* method_code = method->code();
1078 if (method_code != NULL) {
1079 if (compilation_is_complete(method, osr_bci, comp_level)) {
1080 return method_code;
1081 }
1082 }
|
1043 }
1044 AbstractCompiler *comp = CompileBroker::compiler(comp_level);
1045 assert(comp != NULL, "Ensure we don't compile before compilebroker init");
1046 DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, comp);
1047 nmethod* nm = CompileBroker::compile_method(method, osr_bci, comp_level, hot_method, hot_count, comment, directive, THREAD);
1048 DirectivesStack::release(directive);
1049 return nm;
1050 }
1051
1052 nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
1053 int comp_level,
1054 const methodHandle& hot_method, int hot_count,
1055 const char* comment, DirectiveSet* directive,
1056 Thread* THREAD) {
1057
1058 // make sure arguments make sense
1059 assert(method->method_holder()->is_instance_klass(), "not an instance method");
1060 assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range");
1061 assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods");
1062 assert(!method->method_holder()->is_not_initialized(), "method holder must be initialized");
1063 assert(!TieredCompilation || comp_level <= TieredStopAtLevel, "Invalid compilation level");
1064 // allow any levels for WhiteBox
1065 assert(WhiteBoxAPI || TieredCompilation || comp_level == CompLevel_highest_tier, "only CompLevel_highest_tier must be used in non-tiered");
1066 // return quickly if possible
1067
1068 // lock, make sure that the compilation
1069 // isn't prohibited in a straightforward way.
1070 AbstractCompiler *comp = CompileBroker::compiler(comp_level);
1071 if (!comp->can_compile_method(method) ||
1072 compilation_is_prohibited(method, osr_bci, comp_level, directive->ExcludeOption)) {
1073 return NULL;
1074 }
1075
1076 if (osr_bci == InvocationEntryBci) {
1077 // standard compilation
1078 nmethod* method_code = method->code();
1079 if (method_code != NULL) {
1080 if (compilation_is_complete(method, osr_bci, comp_level)) {
1081 return method_code;
1082 }
1083 }
|