equal
deleted
inserted
replaced
362 } |
362 } |
363 #endif |
363 #endif |
364 |
364 |
365 void ErrorContext::details(outputStream* ss, const Method* method) const { |
365 void ErrorContext::details(outputStream* ss, const Method* method) const { |
366 if (is_valid()) { |
366 if (is_valid()) { |
367 ss->print_cr(""); |
367 ss->cr(); |
368 ss->print_cr("Exception Details:"); |
368 ss->print_cr("Exception Details:"); |
369 location_details(ss, method); |
369 location_details(ss, method); |
370 reason_details(ss); |
370 reason_details(ss); |
371 frame_details(ss); |
371 frame_details(ss); |
372 bytecode_details(ss, method); |
372 bytecode_details(ss, method); |
377 |
377 |
378 void ErrorContext::reason_details(outputStream* ss) const { |
378 void ErrorContext::reason_details(outputStream* ss) const { |
379 streamIndentor si(ss); |
379 streamIndentor si(ss); |
380 ss->indent().print_cr("Reason:"); |
380 ss->indent().print_cr("Reason:"); |
381 streamIndentor si2(ss); |
381 streamIndentor si2(ss); |
382 ss->indent().print(""); |
382 ss->indent().print("%s", ""); |
383 switch (_fault) { |
383 switch (_fault) { |
384 case INVALID_BYTECODE: |
384 case INVALID_BYTECODE: |
385 ss->print("Error exists in the bytecode"); |
385 ss->print("Error exists in the bytecode"); |
386 break; |
386 break; |
387 case WRONG_TYPE: |
387 case WRONG_TYPE: |
430 case UNKNOWN: |
430 case UNKNOWN: |
431 default: |
431 default: |
432 ShouldNotReachHere(); |
432 ShouldNotReachHere(); |
433 ss->print_cr("Unknown"); |
433 ss->print_cr("Unknown"); |
434 } |
434 } |
435 ss->print_cr(""); |
435 ss->cr(); |
436 } |
436 } |
437 |
437 |
438 void ErrorContext::location_details(outputStream* ss, const Method* method) const { |
438 void ErrorContext::location_details(outputStream* ss, const Method* method) const { |
439 if (_bci != -1 && method != NULL) { |
439 if (_bci != -1 && method != NULL) { |
440 streamIndentor si(ss); |
440 streamIndentor si(ss); |
505 streamIndentor si2(ss); |
505 streamIndentor si2(ss); |
506 int current_offset = -1; |
506 int current_offset = -1; |
507 for (u2 i = 0; i < sm_table->number_of_entries(); ++i) { |
507 for (u2 i = 0; i < sm_table->number_of_entries(); ++i) { |
508 ss->indent(); |
508 ss->indent(); |
509 sm_frame->print_on(ss, current_offset); |
509 sm_frame->print_on(ss, current_offset); |
510 ss->print_cr(""); |
510 ss->cr(); |
511 current_offset += sm_frame->offset_delta(); |
511 current_offset += sm_frame->offset_delta(); |
512 sm_frame = sm_frame->next(); |
512 sm_frame = sm_frame->next(); |
513 } |
513 } |
514 } |
514 } |
515 } |
515 } |
577 _method = m; // initialize _method |
577 _method = m; // initialize _method |
578 if (VerboseVerification) { |
578 if (VerboseVerification) { |
579 tty->print_cr("Verifying method %s", m->name_and_sig_as_C_string()); |
579 tty->print_cr("Verifying method %s", m->name_and_sig_as_C_string()); |
580 } |
580 } |
581 |
581 |
582 const char* bad_type_msg = "Bad type on operand stack in %s"; |
582 // For clang, the only good constant format string is a literal constant format string. |
|
583 #define bad_type_msg "Bad type on operand stack in %s" |
583 |
584 |
584 int32_t max_stack = m->verifier_max_stack(); |
585 int32_t max_stack = m->verifier_max_stack(); |
585 int32_t max_locals = m->max_locals(); |
586 int32_t max_locals = m->max_locals(); |
586 constantPoolHandle cp(THREAD, m->constants()); |
587 constantPoolHandle cp(THREAD, m->constants()); |
587 |
588 |
1673 verify_error(ErrorContext::bad_code(code_length), |
1674 verify_error(ErrorContext::bad_code(code_length), |
1674 "Control flow falls through code end"); |
1675 "Control flow falls through code end"); |
1675 return; |
1676 return; |
1676 } |
1677 } |
1677 } |
1678 } |
|
1679 |
|
1680 #undef bad_type_message |
1678 |
1681 |
1679 char* ClassVerifier::generate_code_data(methodHandle m, u4 code_length, TRAPS) { |
1682 char* ClassVerifier::generate_code_data(methodHandle m, u4 code_length, TRAPS) { |
1680 char* code_data = NEW_RESOURCE_ARRAY(char, code_length); |
1683 char* code_data = NEW_RESOURCE_ARRAY(char, code_length); |
1681 memset(code_data, 0, sizeof(char) * code_length); |
1684 memset(code_data, 0, sizeof(char) * code_length); |
1682 RawBytecodeStream bcs(m); |
1685 RawBytecodeStream bcs(m); |
2361 // Get referenced class type |
2364 // Get referenced class type |
2362 VerificationType ref_class_type; |
2365 VerificationType ref_class_type; |
2363 if (opcode == Bytecodes::_invokedynamic) { |
2366 if (opcode == Bytecodes::_invokedynamic) { |
2364 if (_klass->major_version() < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) { |
2367 if (_klass->major_version() < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) { |
2365 class_format_error( |
2368 class_format_error( |
2366 "invokedynamic instructions not supported by this class file version", |
2369 "invokedynamic instructions not supported by this class file version (%d), class %s", |
2367 _klass->external_name()); |
2370 _klass->major_version(), _klass->external_name()); |
2368 return; |
2371 return; |
2369 } |
2372 } |
2370 } else { |
2373 } else { |
2371 ref_class_type = cp_ref_index_to_type(index, cp, CHECK_VERIFY(this)); |
2374 ref_class_type = cp_ref_index_to_type(index, cp, CHECK_VERIFY(this)); |
2372 } |
2375 } |