7131259: compile_method and CompilationPolicy::event shouldn't be declared TRAPS
Make sure that CompilationPolicy::event() doesn't throw exceptions Reviewed-by: kvn, never
This commit is contained in:
parent
070f9108ff
commit
84dda879d0
@ -413,8 +413,9 @@ static nmethod* counter_overflow_helper(JavaThread* THREAD, int branch_bci, meth
|
||||
}
|
||||
bci = branch_bci + offset;
|
||||
}
|
||||
|
||||
assert(!HAS_PENDING_EXCEPTION, "Should not have any exceptions pending");
|
||||
osr_nm = CompilationPolicy::policy()->event(enclosing_method, method, branch_bci, bci, level, nm, THREAD);
|
||||
assert(!HAS_PENDING_EXCEPTION, "Event handler should not throw any exceptions");
|
||||
return osr_nm;
|
||||
}
|
||||
|
||||
|
@ -961,7 +961,7 @@ void CompileBroker::compile_method_base(methodHandle method,
|
||||
methodHandle hot_method,
|
||||
int hot_count,
|
||||
const char* comment,
|
||||
TRAPS) {
|
||||
Thread* thread) {
|
||||
// do nothing if compiler thread(s) is not available
|
||||
if (!_initialized ) {
|
||||
return;
|
||||
@ -1037,7 +1037,7 @@ void CompileBroker::compile_method_base(methodHandle method,
|
||||
|
||||
// Acquire our lock.
|
||||
{
|
||||
MutexLocker locker(queue->lock(), THREAD);
|
||||
MutexLocker locker(queue->lock(), thread);
|
||||
|
||||
// Make sure the method has not slipped into the queues since
|
||||
// last we checked; note that those checks were "fast bail-outs".
|
||||
@ -1119,7 +1119,7 @@ void CompileBroker::compile_method_base(methodHandle method,
|
||||
nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci,
|
||||
int comp_level,
|
||||
methodHandle hot_method, int hot_count,
|
||||
const char* comment, TRAPS) {
|
||||
const char* comment, Thread* THREAD) {
|
||||
// make sure arguments make sense
|
||||
assert(method->method_holder()->klass_part()->oop_is_instance(), "not an instance method");
|
||||
assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range");
|
||||
@ -1173,10 +1173,10 @@ nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci,
|
||||
assert(!HAS_PENDING_EXCEPTION, "No exception should be present");
|
||||
// some prerequisites that are compiler specific
|
||||
if (compiler(comp_level)->is_c2() || compiler(comp_level)->is_shark()) {
|
||||
method->constants()->resolve_string_constants(CHECK_0);
|
||||
method->constants()->resolve_string_constants(CHECK_AND_CLEAR_NULL);
|
||||
// Resolve all classes seen in the signature of the method
|
||||
// we are compiling.
|
||||
methodOopDesc::load_signature_classes(method, CHECK_0);
|
||||
methodOopDesc::load_signature_classes(method, CHECK_AND_CLEAR_NULL);
|
||||
}
|
||||
|
||||
// If the method is native, do the lookup in the thread requesting
|
||||
@ -1230,7 +1230,7 @@ nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci,
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, comment, CHECK_0);
|
||||
compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, comment, THREAD);
|
||||
}
|
||||
|
||||
// return requested nmethod
|
||||
|
@ -333,7 +333,7 @@ class CompileBroker: AllStatic {
|
||||
methodHandle hot_method,
|
||||
int hot_count,
|
||||
const char* comment,
|
||||
TRAPS);
|
||||
Thread* thread);
|
||||
static CompileQueue* compile_queue(int comp_level) {
|
||||
if (is_c2_compile(comp_level)) return _c2_method_queue;
|
||||
if (is_c1_compile(comp_level)) return _c1_method_queue;
|
||||
@ -363,7 +363,7 @@ class CompileBroker: AllStatic {
|
||||
int comp_level,
|
||||
methodHandle hot_method,
|
||||
int hot_count,
|
||||
const char* comment, TRAPS);
|
||||
const char* comment, Thread* thread);
|
||||
|
||||
static void compiler_thread_loop();
|
||||
|
||||
|
@ -859,7 +859,9 @@ IRT_ENTRY(nmethod*,
|
||||
const int branch_bci = branch_bcp != NULL ? method->bci_from(branch_bcp) : InvocationEntryBci;
|
||||
const int bci = branch_bcp != NULL ? method->bci_from(fr.interpreter_frame_bcp()) : InvocationEntryBci;
|
||||
|
||||
assert(!HAS_PENDING_EXCEPTION, "Should not have any exceptions pending");
|
||||
nmethod* osr_nm = CompilationPolicy::policy()->event(method, method, branch_bci, bci, CompLevel_none, NULL, thread);
|
||||
assert(!HAS_PENDING_EXCEPTION, "Event handler should not throw any exceptions");
|
||||
|
||||
if (osr_nm != NULL) {
|
||||
// We may need to do on-stack replacement which requires that no
|
||||
|
@ -271,13 +271,10 @@ bool AdvancedThresholdPolicy::should_not_inline(ciEnv* env, ciMethod* callee) {
|
||||
}
|
||||
|
||||
// Create MDO if necessary.
|
||||
void AdvancedThresholdPolicy::create_mdo(methodHandle mh, TRAPS) {
|
||||
void AdvancedThresholdPolicy::create_mdo(methodHandle mh, JavaThread* THREAD) {
|
||||
if (mh->is_native() || mh->is_abstract() || mh->is_accessor()) return;
|
||||
if (mh->method_data() == NULL) {
|
||||
methodOopDesc::build_interpreter_method_data(mh, THREAD);
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
}
|
||||
methodOopDesc::build_interpreter_method_data(mh, CHECK_AND_CLEAR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -426,22 +423,22 @@ CompLevel AdvancedThresholdPolicy::loop_event(methodOop method, CompLevel cur_le
|
||||
}
|
||||
|
||||
// Update the rate and submit compile
|
||||
void AdvancedThresholdPolicy::submit_compile(methodHandle mh, int bci, CompLevel level, TRAPS) {
|
||||
void AdvancedThresholdPolicy::submit_compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread) {
|
||||
int hot_count = (bci == InvocationEntryBci) ? mh->invocation_count() : mh->backedge_count();
|
||||
update_rate(os::javaTimeMillis(), mh());
|
||||
CompileBroker::compile_method(mh, bci, level, mh, hot_count, "tiered", THREAD);
|
||||
CompileBroker::compile_method(mh, bci, level, mh, hot_count, "tiered", thread);
|
||||
}
|
||||
|
||||
// Handle the invocation event.
|
||||
void AdvancedThresholdPolicy::method_invocation_event(methodHandle mh, methodHandle imh,
|
||||
CompLevel level, nmethod* nm, TRAPS) {
|
||||
CompLevel level, nmethod* nm, JavaThread* thread) {
|
||||
if (should_create_mdo(mh(), level)) {
|
||||
create_mdo(mh, THREAD);
|
||||
create_mdo(mh, thread);
|
||||
}
|
||||
if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, InvocationEntryBci)) {
|
||||
CompLevel next_level = call_event(mh(), level);
|
||||
if (next_level != level) {
|
||||
compile(mh, InvocationEntryBci, next_level, THREAD);
|
||||
compile(mh, InvocationEntryBci, next_level, thread);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -449,13 +446,13 @@ void AdvancedThresholdPolicy::method_invocation_event(methodHandle mh, methodHan
|
||||
// Handle the back branch event. Notice that we can compile the method
|
||||
// with a regular entry from here.
|
||||
void AdvancedThresholdPolicy::method_back_branch_event(methodHandle mh, methodHandle imh,
|
||||
int bci, CompLevel level, nmethod* nm, TRAPS) {
|
||||
int bci, CompLevel level, nmethod* nm, JavaThread* thread) {
|
||||
if (should_create_mdo(mh(), level)) {
|
||||
create_mdo(mh, THREAD);
|
||||
create_mdo(mh, thread);
|
||||
}
|
||||
// Check if MDO should be created for the inlined method
|
||||
if (should_create_mdo(imh(), level)) {
|
||||
create_mdo(imh, THREAD);
|
||||
create_mdo(imh, thread);
|
||||
}
|
||||
|
||||
if (is_compilation_enabled()) {
|
||||
@ -463,7 +460,7 @@ void AdvancedThresholdPolicy::method_back_branch_event(methodHandle mh, methodHa
|
||||
CompLevel max_osr_level = (CompLevel)imh->highest_osr_comp_level();
|
||||
// At the very least compile the OSR version
|
||||
if (!CompileBroker::compilation_is_in_queue(imh, bci) && next_osr_level != level) {
|
||||
compile(imh, bci, next_osr_level, THREAD);
|
||||
compile(imh, bci, next_osr_level, thread);
|
||||
}
|
||||
|
||||
// Use loop event as an opportunity to also check if there's been
|
||||
@ -502,14 +499,14 @@ void AdvancedThresholdPolicy::method_back_branch_event(methodHandle mh, methodHa
|
||||
next_level = CompLevel_full_profile;
|
||||
}
|
||||
if (cur_level != next_level) {
|
||||
compile(mh, InvocationEntryBci, next_level, THREAD);
|
||||
compile(mh, InvocationEntryBci, next_level, thread);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cur_level = comp_level(imh());
|
||||
next_level = call_event(imh(), cur_level);
|
||||
if (!CompileBroker::compilation_is_in_queue(imh, bci) && next_level != cur_level) {
|
||||
compile(imh, InvocationEntryBci, next_level, THREAD);
|
||||
compile(imh, InvocationEntryBci, next_level, thread);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ class AdvancedThresholdPolicy : public SimpleThresholdPolicy {
|
||||
// determines whether we should do that.
|
||||
inline bool should_create_mdo(methodOop method, CompLevel cur_level);
|
||||
// Create MDO if necessary.
|
||||
void create_mdo(methodHandle mh, TRAPS);
|
||||
void create_mdo(methodHandle mh, JavaThread* thread);
|
||||
// Is method profiled enough?
|
||||
bool is_method_profiled(methodOop method);
|
||||
|
||||
@ -208,12 +208,12 @@ protected:
|
||||
jlong start_time() const { return _start_time; }
|
||||
|
||||
// Submit a given method for compilation (and update the rate).
|
||||
virtual void submit_compile(methodHandle mh, int bci, CompLevel level, TRAPS);
|
||||
virtual void submit_compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread);
|
||||
// event() from SimpleThresholdPolicy would call these.
|
||||
virtual void method_invocation_event(methodHandle method, methodHandle inlinee,
|
||||
CompLevel level, nmethod* nm, TRAPS);
|
||||
CompLevel level, nmethod* nm, JavaThread* thread);
|
||||
virtual void method_back_branch_event(methodHandle method, methodHandle inlinee,
|
||||
int bci, CompLevel level, nmethod* nm, TRAPS);
|
||||
int bci, CompLevel level, nmethod* nm, JavaThread* thread);
|
||||
public:
|
||||
AdvancedThresholdPolicy() : _start_time(0) { }
|
||||
// Select task is called by CompileBroker. We should return a task or NULL.
|
||||
|
@ -306,29 +306,27 @@ bool NonTieredCompPolicy::is_mature(methodOop method) {
|
||||
return (current >= initial + target);
|
||||
}
|
||||
|
||||
nmethod* NonTieredCompPolicy::event(methodHandle method, methodHandle inlinee, int branch_bci, int bci, CompLevel comp_level, nmethod* nm, TRAPS) {
|
||||
nmethod* NonTieredCompPolicy::event(methodHandle method, methodHandle inlinee, int branch_bci,
|
||||
int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread) {
|
||||
assert(comp_level == CompLevel_none, "This should be only called from the interpreter");
|
||||
NOT_PRODUCT(trace_frequency_counter_overflow(method, branch_bci, bci));
|
||||
if (JvmtiExport::can_post_interpreter_events()) {
|
||||
assert(THREAD->is_Java_thread(), "Wrong type of thread");
|
||||
if (((JavaThread*)THREAD)->is_interp_only_mode()) {
|
||||
// If certain JVMTI events (e.g. frame pop event) are requested then the
|
||||
// thread is forced to remain in interpreted code. This is
|
||||
// implemented partly by a check in the run_compiled_code
|
||||
// section of the interpreter whether we should skip running
|
||||
// compiled code, and partly by skipping OSR compiles for
|
||||
// interpreted-only threads.
|
||||
if (bci != InvocationEntryBci) {
|
||||
reset_counter_for_back_branch_event(method);
|
||||
return NULL;
|
||||
}
|
||||
if (JvmtiExport::can_post_interpreter_events() && thread->is_interp_only_mode()) {
|
||||
// If certain JVMTI events (e.g. frame pop event) are requested then the
|
||||
// thread is forced to remain in interpreted code. This is
|
||||
// implemented partly by a check in the run_compiled_code
|
||||
// section of the interpreter whether we should skip running
|
||||
// compiled code, and partly by skipping OSR compiles for
|
||||
// interpreted-only threads.
|
||||
if (bci != InvocationEntryBci) {
|
||||
reset_counter_for_back_branch_event(method);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (bci == InvocationEntryBci) {
|
||||
// when code cache is full, compilation gets switched off, UseCompiler
|
||||
// is set to false
|
||||
if (!method->has_compiled_code() && UseCompiler) {
|
||||
method_invocation_event(method, CHECK_NULL);
|
||||
method_invocation_event(method, thread);
|
||||
} else {
|
||||
// Force counter overflow on method entry, even if no compilation
|
||||
// happened. (The method_invocation_event call does this also.)
|
||||
@ -344,7 +342,7 @@ nmethod* NonTieredCompPolicy::event(methodHandle method, methodHandle inlinee, i
|
||||
NOT_PRODUCT(trace_osr_request(method, osr_nm, bci));
|
||||
// when code cache is full, we should not compile any more...
|
||||
if (osr_nm == NULL && UseCompiler) {
|
||||
method_back_branch_event(method, bci, CHECK_NULL);
|
||||
method_back_branch_event(method, bci, thread);
|
||||
osr_nm = method->lookup_osr_nmethod_for(bci, CompLevel_highest_tier, true);
|
||||
}
|
||||
if (osr_nm == NULL) {
|
||||
@ -395,7 +393,7 @@ void NonTieredCompPolicy::trace_osr_request(methodHandle method, nmethod* osr, i
|
||||
|
||||
// SimpleCompPolicy - compile current method
|
||||
|
||||
void SimpleCompPolicy::method_invocation_event( methodHandle m, TRAPS) {
|
||||
void SimpleCompPolicy::method_invocation_event(methodHandle m, JavaThread* thread) {
|
||||
int hot_count = m->invocation_count();
|
||||
reset_counter_for_invocation_event(m);
|
||||
const char* comment = "count";
|
||||
@ -405,18 +403,18 @@ void SimpleCompPolicy::method_invocation_event( methodHandle m, TRAPS) {
|
||||
if (nm == NULL ) {
|
||||
const char* comment = "count";
|
||||
CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_highest_tier,
|
||||
m, hot_count, comment, CHECK);
|
||||
m, hot_count, comment, thread);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleCompPolicy::method_back_branch_event(methodHandle m, int bci, TRAPS) {
|
||||
void SimpleCompPolicy::method_back_branch_event(methodHandle m, int bci, JavaThread* thread) {
|
||||
int hot_count = m->backedge_count();
|
||||
const char* comment = "backedge_count";
|
||||
|
||||
if (is_compilation_enabled() && !m->is_not_osr_compilable() && can_be_compiled(m)) {
|
||||
CompileBroker::compile_method(m, bci, CompLevel_highest_tier,
|
||||
m, hot_count, comment, CHECK);
|
||||
m, hot_count, comment, thread);
|
||||
NOT_PRODUCT(trace_osr_completion(m->lookup_osr_nmethod_for(bci, CompLevel_highest_tier, true));)
|
||||
}
|
||||
}
|
||||
@ -427,14 +425,13 @@ const char* StackWalkCompPolicy::_msg = NULL;
|
||||
|
||||
|
||||
// Consider m for compilation
|
||||
void StackWalkCompPolicy::method_invocation_event(methodHandle m, TRAPS) {
|
||||
void StackWalkCompPolicy::method_invocation_event(methodHandle m, JavaThread* thread) {
|
||||
int hot_count = m->invocation_count();
|
||||
reset_counter_for_invocation_event(m);
|
||||
const char* comment = "count";
|
||||
|
||||
if (is_compilation_enabled() && m->code() == NULL && can_be_compiled(m)) {
|
||||
ResourceMark rm(THREAD);
|
||||
JavaThread *thread = (JavaThread*)THREAD;
|
||||
ResourceMark rm(thread);
|
||||
frame fr = thread->last_frame();
|
||||
assert(fr.is_interpreted_frame(), "must be interpreted");
|
||||
assert(fr.interpreter_frame_method() == m(), "bad method");
|
||||
@ -461,17 +458,17 @@ void StackWalkCompPolicy::method_invocation_event(methodHandle m, TRAPS) {
|
||||
assert(top != NULL, "findTopInlinableFrame returned null");
|
||||
if (TraceCompilationPolicy) top->print();
|
||||
CompileBroker::compile_method(top->top_method(), InvocationEntryBci, CompLevel_highest_tier,
|
||||
m, hot_count, comment, CHECK);
|
||||
m, hot_count, comment, thread);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StackWalkCompPolicy::method_back_branch_event(methodHandle m, int bci, TRAPS) {
|
||||
void StackWalkCompPolicy::method_back_branch_event(methodHandle m, int bci, JavaThread* thread) {
|
||||
int hot_count = m->backedge_count();
|
||||
const char* comment = "backedge_count";
|
||||
|
||||
if (is_compilation_enabled() && !m->is_not_osr_compilable() && can_be_compiled(m)) {
|
||||
CompileBroker::compile_method(m, bci, CompLevel_highest_tier, m, hot_count, comment, CHECK);
|
||||
CompileBroker::compile_method(m, bci, CompLevel_highest_tier, m, hot_count, comment, thread);
|
||||
|
||||
NOT_PRODUCT(trace_osr_completion(m->lookup_osr_nmethod_for(bci, CompLevel_highest_tier, true));)
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
virtual int compiler_count(CompLevel comp_level) = 0;
|
||||
// main notification entry, return a pointer to an nmethod if the OSR is required,
|
||||
// returns NULL otherwise.
|
||||
virtual nmethod* event(methodHandle method, methodHandle inlinee, int branch_bci, int bci, CompLevel comp_level, nmethod* nm, TRAPS) = 0;
|
||||
virtual nmethod* event(methodHandle method, methodHandle inlinee, int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread) = 0;
|
||||
// safepoint() is called at the end of the safepoint
|
||||
virtual void do_safepoint_work() = 0;
|
||||
// reprofile request
|
||||
@ -105,15 +105,15 @@ public:
|
||||
virtual bool is_mature(methodOop method);
|
||||
virtual void initialize();
|
||||
virtual CompileTask* select_task(CompileQueue* compile_queue);
|
||||
virtual nmethod* event(methodHandle method, methodHandle inlinee, int branch_bci, int bci, CompLevel comp_level, nmethod* nm, TRAPS);
|
||||
virtual void method_invocation_event(methodHandle m, TRAPS) = 0;
|
||||
virtual void method_back_branch_event(methodHandle m, int bci, TRAPS) = 0;
|
||||
virtual nmethod* event(methodHandle method, methodHandle inlinee, int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread);
|
||||
virtual void method_invocation_event(methodHandle m, JavaThread* thread) = 0;
|
||||
virtual void method_back_branch_event(methodHandle m, int bci, JavaThread* thread) = 0;
|
||||
};
|
||||
|
||||
class SimpleCompPolicy : public NonTieredCompPolicy {
|
||||
public:
|
||||
virtual void method_invocation_event(methodHandle m, TRAPS);
|
||||
virtual void method_back_branch_event(methodHandle m, int bci, TRAPS);
|
||||
virtual void method_invocation_event(methodHandle m, JavaThread* thread);
|
||||
virtual void method_back_branch_event(methodHandle m, int bci, JavaThread* thread);
|
||||
};
|
||||
|
||||
// StackWalkCompPolicy - existing C2 policy
|
||||
@ -121,8 +121,8 @@ class SimpleCompPolicy : public NonTieredCompPolicy {
|
||||
#ifdef COMPILER2
|
||||
class StackWalkCompPolicy : public NonTieredCompPolicy {
|
||||
public:
|
||||
virtual void method_invocation_event(methodHandle m, TRAPS);
|
||||
virtual void method_back_branch_event(methodHandle m, int bci, TRAPS);
|
||||
virtual void method_invocation_event(methodHandle m, JavaThread* thread);
|
||||
virtual void method_back_branch_event(methodHandle m, int bci, JavaThread* thread);
|
||||
|
||||
private:
|
||||
RFrame* findTopInlinableFrame(GrowableArray<RFrame*>* stack);
|
||||
|
@ -177,13 +177,11 @@ void SimpleThresholdPolicy::reprofile(ScopeDesc* trap_scope, bool is_osr) {
|
||||
}
|
||||
|
||||
nmethod* SimpleThresholdPolicy::event(methodHandle method, methodHandle inlinee,
|
||||
int branch_bci, int bci, CompLevel comp_level, nmethod* nm, TRAPS) {
|
||||
int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread) {
|
||||
if (comp_level == CompLevel_none &&
|
||||
JvmtiExport::can_post_interpreter_events()) {
|
||||
assert(THREAD->is_Java_thread(), "Should be java thread");
|
||||
if (((JavaThread*)THREAD)->is_interp_only_mode()) {
|
||||
return NULL;
|
||||
}
|
||||
JvmtiExport::can_post_interpreter_events() &&
|
||||
thread->is_interp_only_mode()) {
|
||||
return NULL;
|
||||
}
|
||||
nmethod *osr_nm = NULL;
|
||||
|
||||
@ -197,9 +195,9 @@ nmethod* SimpleThresholdPolicy::event(methodHandle method, methodHandle inlinee,
|
||||
}
|
||||
|
||||
if (bci == InvocationEntryBci) {
|
||||
method_invocation_event(method, inlinee, comp_level, nm, THREAD);
|
||||
method_invocation_event(method, inlinee, comp_level, nm, thread);
|
||||
} else {
|
||||
method_back_branch_event(method, inlinee, bci, comp_level, nm, THREAD);
|
||||
method_back_branch_event(method, inlinee, bci, comp_level, nm, thread);
|
||||
// method == inlinee if the event originated in the main method
|
||||
int highest_level = inlinee->highest_osr_comp_level();
|
||||
if (highest_level > comp_level) {
|
||||
@ -210,7 +208,7 @@ nmethod* SimpleThresholdPolicy::event(methodHandle method, methodHandle inlinee,
|
||||
}
|
||||
|
||||
// Check if the method can be compiled, change level if necessary
|
||||
void SimpleThresholdPolicy::compile(methodHandle mh, int bci, CompLevel level, TRAPS) {
|
||||
void SimpleThresholdPolicy::compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread) {
|
||||
assert(level <= TieredStopAtLevel, "Invalid compilation level");
|
||||
if (level == CompLevel_none) {
|
||||
return;
|
||||
@ -221,7 +219,7 @@ void SimpleThresholdPolicy::compile(methodHandle mh, int bci, CompLevel level, T
|
||||
// pure C1.
|
||||
if (!can_be_compiled(mh, level)) {
|
||||
if (level == CompLevel_full_optimization && can_be_compiled(mh, CompLevel_simple)) {
|
||||
compile(mh, bci, CompLevel_simple, THREAD);
|
||||
compile(mh, bci, CompLevel_simple, thread);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -232,14 +230,14 @@ void SimpleThresholdPolicy::compile(methodHandle mh, int bci, CompLevel level, T
|
||||
if (PrintTieredEvents) {
|
||||
print_event(COMPILE, mh, mh, bci, level);
|
||||
}
|
||||
submit_compile(mh, bci, level, THREAD);
|
||||
submit_compile(mh, bci, level, thread);
|
||||
}
|
||||
}
|
||||
|
||||
// Tell the broker to compile the method
|
||||
void SimpleThresholdPolicy::submit_compile(methodHandle mh, int bci, CompLevel level, TRAPS) {
|
||||
void SimpleThresholdPolicy::submit_compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread) {
|
||||
int hot_count = (bci == InvocationEntryBci) ? mh->invocation_count() : mh->backedge_count();
|
||||
CompileBroker::compile_method(mh, bci, level, mh, hot_count, "tiered", THREAD);
|
||||
CompileBroker::compile_method(mh, bci, level, mh, hot_count, "tiered", thread);
|
||||
}
|
||||
|
||||
// Call and loop predicates determine whether a transition to a higher
|
||||
@ -366,11 +364,11 @@ CompLevel SimpleThresholdPolicy::loop_event(methodOop method, CompLevel cur_leve
|
||||
|
||||
// Handle the invocation event.
|
||||
void SimpleThresholdPolicy::method_invocation_event(methodHandle mh, methodHandle imh,
|
||||
CompLevel level, nmethod* nm, TRAPS) {
|
||||
CompLevel level, nmethod* nm, JavaThread* thread) {
|
||||
if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, InvocationEntryBci)) {
|
||||
CompLevel next_level = call_event(mh(), level);
|
||||
if (next_level != level) {
|
||||
compile(mh, InvocationEntryBci, next_level, THREAD);
|
||||
compile(mh, InvocationEntryBci, next_level, thread);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -378,7 +376,7 @@ void SimpleThresholdPolicy::method_invocation_event(methodHandle mh, methodHandl
|
||||
// Handle the back branch event. Notice that we can compile the method
|
||||
// with a regular entry from here.
|
||||
void SimpleThresholdPolicy::method_back_branch_event(methodHandle mh, methodHandle imh,
|
||||
int bci, CompLevel level, nmethod* nm, TRAPS) {
|
||||
int bci, CompLevel level, nmethod* nm, JavaThread* thread) {
|
||||
// If the method is already compiling, quickly bail out.
|
||||
if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, bci)) {
|
||||
// Use loop event as an opportinity to also check there's been
|
||||
@ -391,13 +389,13 @@ void SimpleThresholdPolicy::method_back_branch_event(methodHandle mh, methodHand
|
||||
next_osr_level < CompLevel_full_optimization ? next_osr_level : cur_level);
|
||||
bool is_compiling = false;
|
||||
if (next_level != cur_level) {
|
||||
compile(mh, InvocationEntryBci, next_level, THREAD);
|
||||
compile(mh, InvocationEntryBci, next_level, thread);
|
||||
is_compiling = true;
|
||||
}
|
||||
|
||||
// Do the OSR version
|
||||
if (!is_compiling && next_osr_level != level) {
|
||||
compile(mh, bci, next_osr_level, THREAD);
|
||||
compile(mh, bci, next_osr_level, thread);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,9 +67,9 @@ protected:
|
||||
// Print policy-specific information if necessary
|
||||
virtual void print_specific(EventType type, methodHandle mh, methodHandle imh, int bci, CompLevel level) { }
|
||||
// Check if the method can be compiled, change level if necessary
|
||||
void compile(methodHandle mh, int bci, CompLevel level, TRAPS);
|
||||
void compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread);
|
||||
// Submit a given method for compilation
|
||||
virtual void submit_compile(methodHandle mh, int bci, CompLevel level, TRAPS);
|
||||
virtual void submit_compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread);
|
||||
// Simple methods are as good being compiled with C1 as C2.
|
||||
// This function tells if it's such a function.
|
||||
inline bool is_trivial(methodOop method);
|
||||
@ -88,9 +88,9 @@ protected:
|
||||
return CompLevel_none;
|
||||
}
|
||||
virtual void method_invocation_event(methodHandle method, methodHandle inlinee,
|
||||
CompLevel level, nmethod* nm, TRAPS);
|
||||
CompLevel level, nmethod* nm, JavaThread* thread);
|
||||
virtual void method_back_branch_event(methodHandle method, methodHandle inlinee,
|
||||
int bci, CompLevel level, nmethod* nm, TRAPS);
|
||||
int bci, CompLevel level, nmethod* nm, JavaThread* thread);
|
||||
public:
|
||||
SimpleThresholdPolicy() : _c1_count(0), _c2_count(0) { }
|
||||
virtual int compiler_count(CompLevel comp_level) {
|
||||
@ -104,7 +104,7 @@ public:
|
||||
virtual void disable_compilation(methodOop method) { }
|
||||
virtual void reprofile(ScopeDesc* trap_scope, bool is_osr);
|
||||
virtual nmethod* event(methodHandle method, methodHandle inlinee,
|
||||
int branch_bci, int bci, CompLevel comp_level, nmethod* nm, TRAPS);
|
||||
int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread);
|
||||
// Select task is called by CompileBroker. We should return a task or NULL.
|
||||
virtual CompileTask* select_task(CompileQueue* compile_queue);
|
||||
// Tell the runtime if we think a given method is adequately profiled.
|
||||
|
@ -189,6 +189,13 @@ class Exceptions {
|
||||
#define CHECK_NULL CHECK_(NULL)
|
||||
#define CHECK_false CHECK_(false)
|
||||
|
||||
#define CHECK_AND_CLEAR THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_EXCEPTION; return; } (0
|
||||
#define CHECK_AND_CLEAR_(result) THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_EXCEPTION; return result; } (0
|
||||
#define CHECK_AND_CLEAR_0 CHECK_AND_CLEAR_(0)
|
||||
#define CHECK_AND_CLEAR_NH CHECK_AND_CLEAR_(Handle())
|
||||
#define CHECK_AND_CLEAR_NULL CHECK_AND_CLEAR_(NULL)
|
||||
#define CHECK_AND_CLEAR_false CHECK_AND_CLEAR_(false)
|
||||
|
||||
// The THROW... macros should be used to throw an exception. They require a THREAD variable to be
|
||||
// visible within the scope containing the THROW. Usually this is achieved by declaring the function
|
||||
// with a TRAPS argument.
|
||||
@ -258,7 +265,6 @@ class Exceptions {
|
||||
ShouldNotReachHere(); \
|
||||
} (0
|
||||
|
||||
|
||||
// ExceptionMark is a stack-allocated helper class for local exception handling.
|
||||
// It is used with the EXCEPTION_MARK macro.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user