src/hotspot/share/ci/ciEnv.cpp
changeset 48299 e8f5fc8f5f67
parent 48007 ab3959df2115
child 48502 13f6856e8489
equal deleted inserted replaced
48298:40b9faefb496 48299:e8f5fc8f5f67
   897 // Check for changes during compilation (e.g. class loads, evolution,
   897 // Check for changes during compilation (e.g. class loads, evolution,
   898 // breakpoints, call site invalidation).
   898 // breakpoints, call site invalidation).
   899 void ciEnv::validate_compile_task_dependencies(ciMethod* target) {
   899 void ciEnv::validate_compile_task_dependencies(ciMethod* target) {
   900   if (failing())  return;  // no need for further checks
   900   if (failing())  return;  // no need for further checks
   901 
   901 
   902   // First, check non-klass dependencies as we might return early and
       
   903   // not check klass dependencies if the system dictionary
       
   904   // modification counter hasn't changed (see below).
       
   905   for (Dependencies::DepStream deps(dependencies()); deps.next(); ) {
       
   906     if (deps.is_klass_type())  continue;  // skip klass dependencies
       
   907     Klass* witness = deps.check_dependency();
       
   908     if (witness != NULL) {
       
   909       if (deps.type() == Dependencies::call_site_target_value) {
       
   910         _inc_decompile_count_on_failure = false;
       
   911         record_failure("call site target change");
       
   912       } else {
       
   913         record_failure("invalid non-klass dependency");
       
   914       }
       
   915       return;
       
   916     }
       
   917   }
       
   918 
       
   919   // Klass dependencies must be checked when the system dictionary
       
   920   // changes.  If logging is enabled all violated dependences will be
       
   921   // recorded in the log.  In debug mode check dependencies even if
       
   922   // the system dictionary hasn't changed to verify that no invalid
       
   923   // dependencies were inserted.  Any violated dependences in this
       
   924   // case are dumped to the tty.
       
   925   bool counter_changed = system_dictionary_modification_counter_changed();
   902   bool counter_changed = system_dictionary_modification_counter_changed();
   926 
   903   Dependencies::DepType result = dependencies()->validate_dependencies(_task, counter_changed);
   927   bool verify_deps = trueInDebug;
   904   if (result != Dependencies::end_marker) {
   928   if (!counter_changed && !verify_deps)  return;
   905     if (result == Dependencies::call_site_target_value) {
   929 
   906       _inc_decompile_count_on_failure = false;
   930   int klass_violations = 0;
   907       record_failure("call site target change");
   931   for (Dependencies::DepStream deps(dependencies()); deps.next(); ) {
   908     } else if (Dependencies::is_klass_type(result)) {
   932     if (!deps.is_klass_type())  continue;  // skip non-klass dependencies
   909       record_failure("invalid non-klass dependency");
   933     Klass* witness = deps.check_dependency();
   910     } else {
   934     if (witness != NULL) {
   911       record_failure("concurrent class loading");
   935       klass_violations++;
   912     }
   936       if (!counter_changed) {
       
   937         // Dependence failed but counter didn't change.  Log a message
       
   938         // describing what failed and allow the assert at the end to
       
   939         // trigger.
       
   940         deps.print_dependency(witness);
       
   941       } else if (xtty == NULL) {
       
   942         // If we're not logging then a single violation is sufficient,
       
   943         // otherwise we want to log all the dependences which were
       
   944         // violated.
       
   945         break;
       
   946       }
       
   947     }
       
   948   }
       
   949 
       
   950   if (klass_violations != 0) {
       
   951 #ifdef ASSERT
       
   952     if (!counter_changed && !PrintCompilation) {
       
   953       // Print out the compile task that failed
       
   954       _task->print_tty();
       
   955     }
       
   956 #endif
       
   957     assert(counter_changed, "failed dependencies, but counter didn't change");
       
   958     record_failure("concurrent class loading");
       
   959   }
   913   }
   960 }
   914 }
   961 
   915 
   962 // ------------------------------------------------------------------
   916 // ------------------------------------------------------------------
   963 // ciEnv::register_method
   917 // ciEnv::register_method