src/share/vm/classfile/verifier.cpp

changeset 6782
f73af4455d7d
parent 6779
364b73402247
parent 6680
78bbf4d43a14
child 6785
d6fcbd1e1075
child 6830
54bc75c144b0
     1.1 --- a/src/share/vm/classfile/verifier.cpp	Wed May 28 12:07:21 2014 -0700
     1.2 +++ b/src/share/vm/classfile/verifier.cpp	Thu May 29 09:56:06 2014 -0700
     1.3 @@ -364,7 +364,7 @@
     1.4  
     1.5  void ErrorContext::details(outputStream* ss, const Method* method) const {
     1.6    if (is_valid()) {
     1.7 -    ss->print_cr("");
     1.8 +    ss->cr();
     1.9      ss->print_cr("Exception Details:");
    1.10      location_details(ss, method);
    1.11      reason_details(ss);
    1.12 @@ -379,7 +379,7 @@
    1.13    streamIndentor si(ss);
    1.14    ss->indent().print_cr("Reason:");
    1.15    streamIndentor si2(ss);
    1.16 -  ss->indent().print("");
    1.17 +  ss->indent().print("%s", "");
    1.18    switch (_fault) {
    1.19      case INVALID_BYTECODE:
    1.20        ss->print("Error exists in the bytecode");
    1.21 @@ -432,7 +432,7 @@
    1.22        ShouldNotReachHere();
    1.23        ss->print_cr("Unknown");
    1.24    }
    1.25 -  ss->print_cr("");
    1.26 +  ss->cr();
    1.27  }
    1.28  
    1.29  void ErrorContext::location_details(outputStream* ss, const Method* method) const {
    1.30 @@ -507,7 +507,7 @@
    1.31      for (u2 i = 0; i < sm_table->number_of_entries(); ++i) {
    1.32        ss->indent();
    1.33        sm_frame->print_on(ss, current_offset);
    1.34 -      ss->print_cr("");
    1.35 +      ss->cr();
    1.36        current_offset += sm_frame->offset_delta();
    1.37        sm_frame = sm_frame->next();
    1.38      }
    1.39 @@ -579,7 +579,8 @@
    1.40      tty->print_cr("Verifying method %s", m->name_and_sig_as_C_string());
    1.41    }
    1.42  
    1.43 -  const char* bad_type_msg = "Bad type on operand stack in %s";
    1.44 +// For clang, the only good constant format string is a literal constant format string.
    1.45 +#define bad_type_msg "Bad type on operand stack in %s"
    1.46  
    1.47    int32_t max_stack = m->verifier_max_stack();
    1.48    int32_t max_locals = m->max_locals();
    1.49 @@ -1679,6 +1680,8 @@
    1.50    }
    1.51  }
    1.52  
    1.53 +#undef bad_type_message
    1.54 +
    1.55  char* ClassVerifier::generate_code_data(methodHandle m, u4 code_length, TRAPS) {
    1.56    char* code_data = NEW_RESOURCE_ARRAY(char, code_length);
    1.57    memset(code_data, 0, sizeof(char) * code_length);
    1.58 @@ -2393,11 +2396,12 @@
    1.59    if (opcode == Bytecodes::_invokedynamic) {
    1.60      if (!EnableInvokeDynamic ||
    1.61          _klass->major_version() < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) {
    1.62 -      class_format_error(
    1.63 -        (!EnableInvokeDynamic ?
    1.64 -         "invokedynamic instructions not enabled in this JVM" :
    1.65 -         "invokedynamic instructions not supported by this class file version"),
    1.66 -        _klass->external_name());
    1.67 +        if (!EnableInvokeDynamic) {
    1.68 +            class_format_error("invokedynamic instructions not enabled in this JVM");
    1.69 +        } else {
    1.70 +            class_format_error("invokedynamic instructions not supported by this class file version (%d), class %s",
    1.71 +                               _klass->major_version(), _klass->external_name());
    1.72 +        }
    1.73        return;
    1.74      }
    1.75    } else {

mercurial