908 // recorded in the log. In debug mode check dependencies even if |
908 // recorded in the log. In debug mode check dependencies even if |
909 // the system dictionary hasn't changed to verify that no invalid |
909 // the system dictionary hasn't changed to verify that no invalid |
910 // dependencies were inserted. Any violated dependences in this |
910 // dependencies were inserted. Any violated dependences in this |
911 // case are dumped to the tty. |
911 // case are dumped to the tty. |
912 bool counter_changed = system_dictionary_modification_counter_changed(); |
912 bool counter_changed = system_dictionary_modification_counter_changed(); |
913 bool test_deps = counter_changed; |
913 |
914 DEBUG_ONLY(test_deps = true); |
914 bool verify_deps = trueInDebug; |
915 if (!test_deps) return; |
915 if (!counter_changed && !verify_deps) return; |
916 |
916 |
917 bool print_failures = false; |
|
918 DEBUG_ONLY(print_failures = !counter_changed); |
|
919 bool keep_going = (print_failures || xtty != NULL); |
|
920 int klass_violations = 0; |
917 int klass_violations = 0; |
921 |
|
922 for (Dependencies::DepStream deps(dependencies()); deps.next(); ) { |
918 for (Dependencies::DepStream deps(dependencies()); deps.next(); ) { |
923 if (!deps.is_klass_type()) continue; // skip non-klass dependencies |
919 if (!deps.is_klass_type()) continue; // skip non-klass dependencies |
924 klassOop witness = deps.check_dependency(); |
920 klassOop witness = deps.check_dependency(); |
925 if (witness != NULL) { |
921 if (witness != NULL) { |
926 klass_violations++; |
922 klass_violations++; |
927 if (print_failures) deps.print_dependency(witness, /*verbose=*/ true); |
923 if (!counter_changed) { |
928 } |
924 // Dependence failed but counter didn't change. Log a message |
929 // If there's no log and we're not sanity-checking, we're done. |
925 // describing what failed and allow the assert at the end to |
930 if (!keep_going) break; |
926 // trigger. |
|
927 deps.print_dependency(witness); |
|
928 } else if (xtty == NULL) { |
|
929 // If we're not logging then a single violation is sufficient, |
|
930 // otherwise we want to log all the dependences which were |
|
931 // violated. |
|
932 break; |
|
933 } |
|
934 } |
931 } |
935 } |
932 |
936 |
933 if (klass_violations != 0) { |
937 if (klass_violations != 0) { |
|
938 #ifdef ASSERT |
|
939 if (!counter_changed && !PrintCompilation) { |
|
940 // Print out the compile task that failed |
|
941 _task->print_line(); |
|
942 } |
|
943 #endif |
934 assert(counter_changed, "failed dependencies, but counter didn't change"); |
944 assert(counter_changed, "failed dependencies, but counter didn't change"); |
935 record_failure("concurrent class loading"); |
945 record_failure("concurrent class loading"); |
936 } |
946 } |
937 } |
947 } |
938 |
948 |