< prev index next >
src/share/vm/runtime/simpleThresholdPolicy.cpp
Print this page
@@ -27,10 +27,13 @@
#include "memory/resourceArea.hpp"
#include "runtime/arguments.hpp"
#include "runtime/simpleThresholdPolicy.hpp"
#include "runtime/simpleThresholdPolicy.inline.hpp"
#include "code/scopeDesc.hpp"
+#if INCLUDE_JVMCI
+#include "jvmci/jvmciRuntime.hpp"
+#endif
void SimpleThresholdPolicy::print_counters(const char* prefix, methodHandle mh) {
int invocation_count = mh->invocation_count();
int backedge_count = mh->backedge_count();
@@ -352,11 +355,11 @@
}
return MIN2(next_level, (CompLevel)TieredStopAtLevel);
}
// Determine if a method should be compiled with a normal entry point at a different level.
-CompLevel SimpleThresholdPolicy::call_event(Method* method, CompLevel cur_level) {
+CompLevel SimpleThresholdPolicy::call_event(Method* method, CompLevel cur_level, JavaThread* thread) {
CompLevel osr_level = MIN2((CompLevel) method->highest_osr_comp_level(),
common(&SimpleThresholdPolicy::loop_predicate, method, cur_level));
CompLevel next_level = common(&SimpleThresholdPolicy::call_predicate, method, cur_level);
// If OSR method level is greater than the regular method level, the levels should be
@@ -369,34 +372,43 @@
next_level = CompLevel_full_optimization;
}
} else {
next_level = MAX2(osr_level, next_level);
}
-
+#if INCLUDE_JVMCI
+ if (UseJVMCICompiler) {
+ next_level = JVMCIRuntime::adjust_comp_level(method, false, next_level, thread);
+ }
+#endif
return next_level;
}
// Determine if we should do an OSR compilation of a given method.
-CompLevel SimpleThresholdPolicy::loop_event(Method* method, CompLevel cur_level) {
+CompLevel SimpleThresholdPolicy::loop_event(Method* method, CompLevel cur_level, JavaThread* thread) {
CompLevel next_level = common(&SimpleThresholdPolicy::loop_predicate, method, cur_level);
if (cur_level == CompLevel_none) {
// If there is a live OSR method that means that we deopted to the interpreter
// for the transition.
CompLevel osr_level = MIN2((CompLevel)method->highest_osr_comp_level(), next_level);
if (osr_level > CompLevel_none) {
return osr_level;
}
}
+#if INCLUDE_JVMCI
+ if (UseJVMCICompiler) {
+ next_level = JVMCIRuntime::adjust_comp_level(method, true, next_level, thread);
+ }
+#endif
return next_level;
}
// Handle the invocation event.
void SimpleThresholdPolicy::method_invocation_event(const methodHandle& mh, const methodHandle& imh,
CompLevel level, CompiledMethod* nm, JavaThread* thread) {
if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) {
- CompLevel next_level = call_event(mh(), level);
+ CompLevel next_level = call_event(mh(), level, thread);
if (next_level != level) {
compile(mh, InvocationEntryBci, next_level, thread);
}
}
}
@@ -408,12 +420,12 @@
// If the method is already compiling, quickly bail out.
if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) {
// Use loop event as an opportunity to also check there's been
// enough calls.
CompLevel cur_level = comp_level(mh());
- CompLevel next_level = call_event(mh(), cur_level);
- CompLevel next_osr_level = loop_event(mh(), level);
+ CompLevel next_level = call_event(mh(), cur_level, thread);
+ CompLevel next_osr_level = loop_event(mh(), level, thread);
next_level = MAX2(next_level,
next_osr_level < CompLevel_full_optimization ? next_osr_level : cur_level);
bool is_compiling = false;
if (next_level != cur_level) {
< prev index next >