src/hotspot/share/classfile/verifier.cpp
changeset 55430 82deab2dd59e
parent 54847 59ea39bb2809
child 58481 48a73ec3a817
equal deleted inserted replaced
55429:d7da94e6c169 55430:82deab2dd59e
   163                            jt->get_thread_stat()->perf_recursion_counts_addr(),
   163                            jt->get_thread_stat()->perf_recursion_counts_addr(),
   164                            jt->get_thread_stat()->perf_timers_addr(),
   164                            jt->get_thread_stat()->perf_timers_addr(),
   165                            PerfClassTraceTime::CLASS_VERIFY);
   165                            PerfClassTraceTime::CLASS_VERIFY);
   166 
   166 
   167   // If the class should be verified, first see if we can use the split
   167   // If the class should be verified, first see if we can use the split
   168   // verifier.  If not, or if verification fails and FailOverToOldVerifier
   168   // verifier.  If not, or if verification fails and can failover, then
   169   // is set, then call the inference verifier.
   169   // call the inference verifier.
   170   Symbol* exception_name = NULL;
   170   Symbol* exception_name = NULL;
   171   const size_t message_buffer_len = klass->name()->utf8_length() + 1024;
   171   const size_t message_buffer_len = klass->name()->utf8_length() + 1024;
   172   char* message_buffer = NULL;
   172   char* message_buffer = NULL;
   173   char* exception_message = NULL;
   173   char* exception_message = NULL;
   174 
       
   175   bool can_failover = FailOverToOldVerifier &&
       
   176      klass->major_version() < NOFAILOVER_MAJOR_VERSION;
       
   177 
   174 
   178   log_info(class, init)("Start class verification for: %s", klass->external_name());
   175   log_info(class, init)("Start class verification for: %s", klass->external_name());
   179   if (klass->major_version() >= STACKMAP_ATTRIBUTE_MAJOR_VERSION) {
   176   if (klass->major_version() >= STACKMAP_ATTRIBUTE_MAJOR_VERSION) {
   180     ClassVerifier split_verifier(klass, THREAD);
   177     ClassVerifier split_verifier(klass, THREAD);
   181     split_verifier.verify_class(THREAD);
   178     split_verifier.verify_class(THREAD);
   182     exception_name = split_verifier.result();
   179     exception_name = split_verifier.result();
   183     if (can_failover && !HAS_PENDING_EXCEPTION &&
   180 
       
   181     // If DumpSharedSpaces is set then don't fall back to the old verifier on
       
   182     // verification failure. If a class fails verification with the split verifier,
       
   183     // it might fail the CDS runtime verifier constraint check. In that case, we
       
   184     // don't want to share the class. We only archive classes that pass the split
       
   185     // verifier.
       
   186     bool can_failover = !DumpSharedSpaces &&
       
   187       klass->major_version() < NOFAILOVER_MAJOR_VERSION;
       
   188 
       
   189     if (can_failover && !HAS_PENDING_EXCEPTION &&  // Split verifier doesn't set PENDING_EXCEPTION for failure
   184         (exception_name == vmSymbols::java_lang_VerifyError() ||
   190         (exception_name == vmSymbols::java_lang_VerifyError() ||
   185          exception_name == vmSymbols::java_lang_ClassFormatError())) {
   191          exception_name == vmSymbols::java_lang_ClassFormatError())) {
   186       log_info(verification)("Fail over class verification to old verifier for: %s", klass->external_name());
   192       log_info(verification)("Fail over class verification to old verifier for: %s", klass->external_name());
   187       log_info(class, init)("Fail over class verification to old verifier for: %s", klass->external_name());
   193       log_info(class, init)("Fail over class verification to old verifier for: %s", klass->external_name());
   188       message_buffer = NEW_RESOURCE_ARRAY(char, message_buffer_len);
   194       message_buffer = NEW_RESOURCE_ARRAY(char, message_buffer_len);