comparison src/share/vm/runtime/simpleThresholdPolicy.cpp @ 20804:7848fc12602b

Merge with jdk8u40-b25
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Tue, 07 Apr 2015 14:58:49 +0200
parents 52b4284cb496 468850e35e48
children
comparison
equal deleted inserted replaced
20184:84105dcdb05b 20804:7848fc12602b
194 } 194 }
195 if (CompileTheWorld || ReplayCompiles) { 195 if (CompileTheWorld || ReplayCompiles) {
196 // Don't trigger other compiles in testing mode 196 // Don't trigger other compiles in testing mode
197 return NULL; 197 return NULL;
198 } 198 }
199 nmethod *osr_nm = NULL;
200 199
201 handle_counter_overflow(method()); 200 handle_counter_overflow(method());
202 if (method() != inlinee()) { 201 if (method() != inlinee()) {
203 handle_counter_overflow(inlinee()); 202 handle_counter_overflow(inlinee());
204 } 203 }
208 } 207 }
209 208
210 if (bci == InvocationEntryBci) { 209 if (bci == InvocationEntryBci) {
211 method_invocation_event(method, inlinee, comp_level, nm, thread); 210 method_invocation_event(method, inlinee, comp_level, nm, thread);
212 } else { 211 } else {
212 // method == inlinee if the event originated in the main method
213 method_back_branch_event(method, inlinee, bci, comp_level, nm, thread); 213 method_back_branch_event(method, inlinee, bci, comp_level, nm, thread);
214 // method == inlinee if the event originated in the main method 214 // Check if event led to a higher level OSR compilation
215 int highest_level = inlinee->highest_osr_comp_level(); 215 nmethod* osr_nm = inlinee->lookup_osr_nmethod_for(bci, comp_level, false);
216 if (highest_level > comp_level) { 216 if (osr_nm != NULL && osr_nm->comp_level() > comp_level) {
217 osr_nm = inlinee->lookup_osr_nmethod_for(bci, highest_level, false); 217 // Perform OSR with new nmethod
218 } 218 return osr_nm;
219 } 219 }
220 return osr_nm; 220 }
221 return NULL;
221 } 222 }
222 223
223 // Check if the method can be compiled, change level if necessary 224 // Check if the method can be compiled, change level if necessary
224 void SimpleThresholdPolicy::compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread) { 225 void SimpleThresholdPolicy::compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread) {
225 assert(level <= TieredStopAtLevel, "Invalid compilation level"); 226 assert(level <= TieredStopAtLevel, "Invalid compilation level");
237 return; 238 return;
238 } 239 }
239 if (bci != InvocationEntryBci && mh->is_not_osr_compilable(level)) { 240 if (bci != InvocationEntryBci && mh->is_not_osr_compilable(level)) {
240 return; 241 return;
241 } 242 }
242 if (!CompileBroker::compilation_is_in_queue(mh, bci)) { 243 if (!CompileBroker::compilation_is_in_queue(mh)) {
243 if (PrintTieredEvents) { 244 if (PrintTieredEvents) {
244 print_event(COMPILE, mh, mh, bci, level); 245 print_event(COMPILE, mh, mh, bci, level);
245 } 246 }
246 submit_compile(mh, bci, level, thread); 247 submit_compile(mh, bci, level, thread);
247 } 248 }
376 377
377 378
378 // Handle the invocation event. 379 // Handle the invocation event.
379 void SimpleThresholdPolicy::method_invocation_event(methodHandle mh, methodHandle imh, 380 void SimpleThresholdPolicy::method_invocation_event(methodHandle mh, methodHandle imh,
380 CompLevel level, nmethod* nm, JavaThread* thread) { 381 CompLevel level, nmethod* nm, JavaThread* thread) {
381 if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, InvocationEntryBci)) { 382 if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) {
382 CompLevel next_level = call_event(mh(), level); 383 CompLevel next_level = call_event(mh(), level);
383 if (next_level != level) { 384 if (next_level != level) {
384 compile(mh, InvocationEntryBci, next_level, thread); 385 compile(mh, InvocationEntryBci, next_level, thread);
385 } 386 }
386 } 387 }
389 // Handle the back branch event. Notice that we can compile the method 390 // Handle the back branch event. Notice that we can compile the method
390 // with a regular entry from here. 391 // with a regular entry from here.
391 void SimpleThresholdPolicy::method_back_branch_event(methodHandle mh, methodHandle imh, 392 void SimpleThresholdPolicy::method_back_branch_event(methodHandle mh, methodHandle imh,
392 int bci, CompLevel level, nmethod* nm, JavaThread* thread) { 393 int bci, CompLevel level, nmethod* nm, JavaThread* thread) {
393 // If the method is already compiling, quickly bail out. 394 // If the method is already compiling, quickly bail out.
394 if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, bci)) { 395 if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) {
395 // Use loop event as an opportinity to also check there's been 396 // Use loop event as an opportunity to also check there's been
396 // enough calls. 397 // enough calls.
397 CompLevel cur_level = comp_level(mh()); 398 CompLevel cur_level = comp_level(mh());
398 CompLevel next_level = call_event(mh(), cur_level); 399 CompLevel next_level = call_event(mh(), cur_level);
399 CompLevel next_osr_level = loop_event(mh(), level); 400 CompLevel next_osr_level = loop_event(mh(), level);
400 401