comparison src/share/vm/graal/graalEnv.cpp @ 19426:dd8989d5547f

provide more detail when Graal code installation fails due to a failed dependency check
author Doug Simon <doug.simon@oracle.com>
date Tue, 17 Feb 2015 14:49:05 +0100
parents 98592ae4b1fa
children fb38e004503c
comparison
equal deleted inserted replaced
19425:b6d8deed3fd5 19426:dd8989d5547f
419 } 419 }
420 420
421 // ------------------------------------------------------------------ 421 // ------------------------------------------------------------------
422 // Check for changes to the system dictionary during compilation 422 // Check for changes to the system dictionary during compilation
423 // class loads, evolution, breakpoints 423 // class loads, evolution, breakpoints
424 bool GraalEnv::check_for_system_dictionary_modification(Dependencies* dependencies, GraalEnv* env) { 424 bool GraalEnv::check_for_system_dictionary_modification(Dependencies* dependencies, Handle compiled_code, GraalEnv* env, TRAPS) {
425 // If JVMTI capabilities were enabled during compile, the compilation is invalidated. 425 // If JVMTI capabilities were enabled during compile, the compilation is invalidated.
426 if (env != NULL) { 426 if (env != NULL) {
427 if (!env->_jvmti_can_hotswap_or_post_breakpoint && JvmtiExport::can_hotswap_or_post_breakpoint()) { 427 if (!env->_jvmti_can_hotswap_or_post_breakpoint && JvmtiExport::can_hotswap_or_post_breakpoint()) {
428 // Hotswapping or breakpointing was enabled during compilation 428 Handle message = java_lang_String::create_from_str("Hotswapping or breakpointing was enabled during compilation", THREAD);
429 HotSpotCompiledNmethod::set_installationFailureMessage(compiled_code, message());
429 return false; 430 return false;
430 } 431 }
431 } 432 }
432 433
433 // Dependencies must be checked when the system dictionary changes 434 // Dependencies must be checked when the system dictionary changes
438 if (!counter_changed && !verify_deps) { 439 if (!counter_changed && !verify_deps) {
439 return true; 440 return true;
440 } 441 }
441 442
442 for (Dependencies::DepStream deps(dependencies); deps.next(); ) { 443 for (Dependencies::DepStream deps(dependencies); deps.next(); ) {
443 Klass* witness = deps.check_dependency(); 444 Klass* witness = deps.check_dependency();
444 if (witness != NULL) { 445 if (witness != NULL) {
446 ResourceMark rm;
447 stringStream st;
448 deps.print_dependency(witness, true, &st);
449 Handle message = java_lang_String::create_from_str(st.as_string(), THREAD);
450 HotSpotCompiledNmethod::set_installationFailureMessage(compiled_code, message());
445 return false; 451 return false;
446 } 452 }
447 if (LogCompilation) { 453 if (LogCompilation) {
448 deps.log_dependency(); 454 deps.log_dependency();
449 } 455 }
468 Dependencies* dependencies, 474 Dependencies* dependencies,
469 GraalEnv* env, 475 GraalEnv* env,
470 int compile_id, 476 int compile_id,
471 bool has_unsafe_access, 477 bool has_unsafe_access,
472 Handle installed_code, 478 Handle installed_code,
479 Handle compiled_code,
473 Handle speculation_log) { 480 Handle speculation_log) {
474 GRAAL_EXCEPTION_CONTEXT; 481 GRAAL_EXCEPTION_CONTEXT;
475 NMethodSweeper::possibly_sweep(); 482 NMethodSweeper::possibly_sweep();
476 nm = NULL; 483 nm = NULL;
477 int comp_level = CompLevel_full_optimization; 484 int comp_level = CompLevel_full_optimization;
485 492
486 // Encode the dependencies now, so we can check them right away. 493 // Encode the dependencies now, so we can check them right away.
487 dependencies->encode_content_bytes(); 494 dependencies->encode_content_bytes();
488 495
489 // Check for {class loads, evolution, breakpoints} during compilation 496 // Check for {class loads, evolution, breakpoints} during compilation
490 if (!check_for_system_dictionary_modification(dependencies, env)) { 497 if (!check_for_system_dictionary_modification(dependencies, compiled_code, env, THREAD)) {
491 // While not a true deoptimization, it is a preemptive decompile. 498 // While not a true deoptimization, it is a preemptive decompile.
492 MethodData* mdp = method()->method_data(); 499 MethodData* mdp = method()->method_data();
493 if (mdp != NULL) { 500 if (mdp != NULL) {
494 mdp->inc_decompile_count(); 501 mdp->inc_decompile_count();
495 if (mdp->decompile_count() > (uint)PerMethodRecompilationCutoff) { 502 if (mdp->decompile_count() > (uint)PerMethodRecompilationCutoff) {