1.1 --- a/src/share/vm/runtime/simpleThresholdPolicy.cpp Thu Jan 26 14:14:55 2012 -0800 1.2 +++ b/src/share/vm/runtime/simpleThresholdPolicy.cpp Fri Jan 27 09:04:57 2012 +0100 1.3 @@ -177,13 +177,11 @@ 1.4 } 1.5 1.6 nmethod* SimpleThresholdPolicy::event(methodHandle method, methodHandle inlinee, 1.7 - int branch_bci, int bci, CompLevel comp_level, nmethod* nm, TRAPS) { 1.8 + int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread) { 1.9 if (comp_level == CompLevel_none && 1.10 - JvmtiExport::can_post_interpreter_events()) { 1.11 - assert(THREAD->is_Java_thread(), "Should be java thread"); 1.12 - if (((JavaThread*)THREAD)->is_interp_only_mode()) { 1.13 - return NULL; 1.14 - } 1.15 + JvmtiExport::can_post_interpreter_events() && 1.16 + thread->is_interp_only_mode()) { 1.17 + return NULL; 1.18 } 1.19 nmethod *osr_nm = NULL; 1.20 1.21 @@ -197,9 +195,9 @@ 1.22 } 1.23 1.24 if (bci == InvocationEntryBci) { 1.25 - method_invocation_event(method, inlinee, comp_level, nm, THREAD); 1.26 + method_invocation_event(method, inlinee, comp_level, nm, thread); 1.27 } else { 1.28 - method_back_branch_event(method, inlinee, bci, comp_level, nm, THREAD); 1.29 + method_back_branch_event(method, inlinee, bci, comp_level, nm, thread); 1.30 // method == inlinee if the event originated in the main method 1.31 int highest_level = inlinee->highest_osr_comp_level(); 1.32 if (highest_level > comp_level) { 1.33 @@ -210,7 +208,7 @@ 1.34 } 1.35 1.36 // Check if the method can be compiled, change level if necessary 1.37 -void SimpleThresholdPolicy::compile(methodHandle mh, int bci, CompLevel level, TRAPS) { 1.38 +void SimpleThresholdPolicy::compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread) { 1.39 assert(level <= TieredStopAtLevel, "Invalid compilation level"); 1.40 if (level == CompLevel_none) { 1.41 return; 1.42 @@ -221,7 +219,7 @@ 1.43 // pure C1. 1.44 if (!can_be_compiled(mh, level)) { 1.45 if (level == CompLevel_full_optimization && can_be_compiled(mh, CompLevel_simple)) { 1.46 - compile(mh, bci, CompLevel_simple, THREAD); 1.47 + compile(mh, bci, CompLevel_simple, thread); 1.48 } 1.49 return; 1.50 } 1.51 @@ -232,14 +230,14 @@ 1.52 if (PrintTieredEvents) { 1.53 print_event(COMPILE, mh, mh, bci, level); 1.54 } 1.55 - submit_compile(mh, bci, level, THREAD); 1.56 + submit_compile(mh, bci, level, thread); 1.57 } 1.58 } 1.59 1.60 // Tell the broker to compile the method 1.61 -void SimpleThresholdPolicy::submit_compile(methodHandle mh, int bci, CompLevel level, TRAPS) { 1.62 +void SimpleThresholdPolicy::submit_compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread) { 1.63 int hot_count = (bci == InvocationEntryBci) ? mh->invocation_count() : mh->backedge_count(); 1.64 - CompileBroker::compile_method(mh, bci, level, mh, hot_count, "tiered", THREAD); 1.65 + CompileBroker::compile_method(mh, bci, level, mh, hot_count, "tiered", thread); 1.66 } 1.67 1.68 // Call and loop predicates determine whether a transition to a higher 1.69 @@ -366,11 +364,11 @@ 1.70 1.71 // Handle the invocation event. 1.72 void SimpleThresholdPolicy::method_invocation_event(methodHandle mh, methodHandle imh, 1.73 - CompLevel level, nmethod* nm, TRAPS) { 1.74 + CompLevel level, nmethod* nm, JavaThread* thread) { 1.75 if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, InvocationEntryBci)) { 1.76 CompLevel next_level = call_event(mh(), level); 1.77 if (next_level != level) { 1.78 - compile(mh, InvocationEntryBci, next_level, THREAD); 1.79 + compile(mh, InvocationEntryBci, next_level, thread); 1.80 } 1.81 } 1.82 } 1.83 @@ -378,7 +376,7 @@ 1.84 // Handle the back branch event. Notice that we can compile the method 1.85 // with a regular entry from here. 1.86 void SimpleThresholdPolicy::method_back_branch_event(methodHandle mh, methodHandle imh, 1.87 - int bci, CompLevel level, nmethod* nm, TRAPS) { 1.88 + int bci, CompLevel level, nmethod* nm, JavaThread* thread) { 1.89 // If the method is already compiling, quickly bail out. 1.90 if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, bci)) { 1.91 // Use loop event as an opportinity to also check there's been 1.92 @@ -391,13 +389,13 @@ 1.93 next_osr_level < CompLevel_full_optimization ? next_osr_level : cur_level); 1.94 bool is_compiling = false; 1.95 if (next_level != cur_level) { 1.96 - compile(mh, InvocationEntryBci, next_level, THREAD); 1.97 + compile(mh, InvocationEntryBci, next_level, thread); 1.98 is_compiling = true; 1.99 } 1.100 1.101 // Do the OSR version 1.102 if (!is_compiling && next_osr_level != level) { 1.103 - compile(mh, bci, next_osr_level, THREAD); 1.104 + compile(mh, bci, next_osr_level, thread); 1.105 } 1.106 } 1.107 }