comparison src/share/vm/runtime/advancedThresholdPolicy.cpp @ 4825:20334ed5ed3c

7131259: compile_method and CompilationPolicy::event shouldn't be declared TRAPS Summary: Make sure that CompilationPolicy::event() doesn't throw exceptions Reviewed-by: kvn, never
author iveresov
date Thu, 26 Jan 2012 12:15:24 -0800
parents abcceac2f7cd
children da91efe96a93
comparison
equal deleted inserted replaced
4824:5dbed2f542ff 4825:20334ed5ed3c
269 } 269 }
270 return false; 270 return false;
271 } 271 }
272 272
273 // Create MDO if necessary. 273 // Create MDO if necessary.
274 void AdvancedThresholdPolicy::create_mdo(methodHandle mh, TRAPS) { 274 void AdvancedThresholdPolicy::create_mdo(methodHandle mh, JavaThread* THREAD) {
275 if (mh->is_native() || mh->is_abstract() || mh->is_accessor()) return; 275 if (mh->is_native() || mh->is_abstract() || mh->is_accessor()) return;
276 if (mh->method_data() == NULL) { 276 if (mh->method_data() == NULL) {
277 methodOopDesc::build_interpreter_method_data(mh, THREAD); 277 methodOopDesc::build_interpreter_method_data(mh, CHECK_AND_CLEAR);
278 if (HAS_PENDING_EXCEPTION) {
279 CLEAR_PENDING_EXCEPTION;
280 }
281 } 278 }
282 } 279 }
283 280
284 281
285 /* 282 /*
424 } 421 }
425 return next_level; 422 return next_level;
426 } 423 }
427 424
428 // Update the rate and submit compile 425 // Update the rate and submit compile
429 void AdvancedThresholdPolicy::submit_compile(methodHandle mh, int bci, CompLevel level, TRAPS) { 426 void AdvancedThresholdPolicy::submit_compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread) {
430 int hot_count = (bci == InvocationEntryBci) ? mh->invocation_count() : mh->backedge_count(); 427 int hot_count = (bci == InvocationEntryBci) ? mh->invocation_count() : mh->backedge_count();
431 update_rate(os::javaTimeMillis(), mh()); 428 update_rate(os::javaTimeMillis(), mh());
432 CompileBroker::compile_method(mh, bci, level, mh, hot_count, "tiered", THREAD); 429 CompileBroker::compile_method(mh, bci, level, mh, hot_count, "tiered", thread);
433 } 430 }
434 431
435 // Handle the invocation event. 432 // Handle the invocation event.
436 void AdvancedThresholdPolicy::method_invocation_event(methodHandle mh, methodHandle imh, 433 void AdvancedThresholdPolicy::method_invocation_event(methodHandle mh, methodHandle imh,
437 CompLevel level, nmethod* nm, TRAPS) { 434 CompLevel level, nmethod* nm, JavaThread* thread) {
438 if (should_create_mdo(mh(), level)) { 435 if (should_create_mdo(mh(), level)) {
439 create_mdo(mh, THREAD); 436 create_mdo(mh, thread);
440 } 437 }
441 if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, InvocationEntryBci)) { 438 if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, InvocationEntryBci)) {
442 CompLevel next_level = call_event(mh(), level); 439 CompLevel next_level = call_event(mh(), level);
443 if (next_level != level) { 440 if (next_level != level) {
444 compile(mh, InvocationEntryBci, next_level, THREAD); 441 compile(mh, InvocationEntryBci, next_level, thread);
445 } 442 }
446 } 443 }
447 } 444 }
448 445
449 // Handle the back branch event. Notice that we can compile the method 446 // Handle the back branch event. Notice that we can compile the method
450 // with a regular entry from here. 447 // with a regular entry from here.
451 void AdvancedThresholdPolicy::method_back_branch_event(methodHandle mh, methodHandle imh, 448 void AdvancedThresholdPolicy::method_back_branch_event(methodHandle mh, methodHandle imh,
452 int bci, CompLevel level, nmethod* nm, TRAPS) { 449 int bci, CompLevel level, nmethod* nm, JavaThread* thread) {
453 if (should_create_mdo(mh(), level)) { 450 if (should_create_mdo(mh(), level)) {
454 create_mdo(mh, THREAD); 451 create_mdo(mh, thread);
455 } 452 }
456 // Check if MDO should be created for the inlined method 453 // Check if MDO should be created for the inlined method
457 if (should_create_mdo(imh(), level)) { 454 if (should_create_mdo(imh(), level)) {
458 create_mdo(imh, THREAD); 455 create_mdo(imh, thread);
459 } 456 }
460 457
461 if (is_compilation_enabled()) { 458 if (is_compilation_enabled()) {
462 CompLevel next_osr_level = loop_event(imh(), level); 459 CompLevel next_osr_level = loop_event(imh(), level);
463 CompLevel max_osr_level = (CompLevel)imh->highest_osr_comp_level(); 460 CompLevel max_osr_level = (CompLevel)imh->highest_osr_comp_level();
464 // At the very least compile the OSR version 461 // At the very least compile the OSR version
465 if (!CompileBroker::compilation_is_in_queue(imh, bci) && next_osr_level != level) { 462 if (!CompileBroker::compilation_is_in_queue(imh, bci) && next_osr_level != level) {
466 compile(imh, bci, next_osr_level, THREAD); 463 compile(imh, bci, next_osr_level, thread);
467 } 464 }
468 465
469 // Use loop event as an opportunity to also check if there's been 466 // Use loop event as an opportunity to also check if there's been
470 // enough calls. 467 // enough calls.
471 CompLevel cur_level, next_level; 468 CompLevel cur_level, next_level;
500 // Fix up next_level if necessary to avoid deopts 497 // Fix up next_level if necessary to avoid deopts
501 if (next_level == CompLevel_limited_profile && max_osr_level == CompLevel_full_profile) { 498 if (next_level == CompLevel_limited_profile && max_osr_level == CompLevel_full_profile) {
502 next_level = CompLevel_full_profile; 499 next_level = CompLevel_full_profile;
503 } 500 }
504 if (cur_level != next_level) { 501 if (cur_level != next_level) {
505 compile(mh, InvocationEntryBci, next_level, THREAD); 502 compile(mh, InvocationEntryBci, next_level, thread);
506 } 503 }
507 } 504 }
508 } else { 505 } else {
509 cur_level = comp_level(imh()); 506 cur_level = comp_level(imh());
510 next_level = call_event(imh(), cur_level); 507 next_level = call_event(imh(), cur_level);
511 if (!CompileBroker::compilation_is_in_queue(imh, bci) && next_level != cur_level) { 508 if (!CompileBroker::compilation_is_in_queue(imh, bci) && next_level != cur_level) {
512 compile(imh, InvocationEntryBci, next_level, THREAD); 509 compile(imh, InvocationEntryBci, next_level, thread);
513 } 510 }
514 } 511 }
515 } 512 }
516 } 513 }
517 514