hotspot/src/share/vm/oops/method.cpp
changeset 33148 68fa8b6c4340
parent 33105 294e48b4f704
child 33209 43d7a2139756
child 33198 b37ad9fbf681
equal deleted inserted replaced
33146:77349b58b4c0 33148:68fa8b6c4340
    55 #include "runtime/sharedRuntime.hpp"
    55 #include "runtime/sharedRuntime.hpp"
    56 #include "runtime/signature.hpp"
    56 #include "runtime/signature.hpp"
    57 #include "utilities/quickSort.hpp"
    57 #include "utilities/quickSort.hpp"
    58 #include "utilities/xmlstream.hpp"
    58 #include "utilities/xmlstream.hpp"
    59 
    59 
    60 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
       
    61 
       
    62 // Implementation of Method
    60 // Implementation of Method
    63 
    61 
    64 Method* Method::allocate(ClassLoaderData* loader_data,
    62 Method* Method::allocate(ClassLoaderData* loader_data,
    65                          int byte_code_size,
    63                          int byte_code_size,
    66                          AccessFlags access_flags,
    64                          AccessFlags access_flags,
   248 #ifdef ASSERT
   246 #ifdef ASSERT
   249   {
   247   {
   250     ResourceMark rm;
   248     ResourceMark rm;
   251     assert(is_native() && bcp == code_base() || contains(bcp) || is_error_reported(),
   249     assert(is_native() && bcp == code_base() || contains(bcp) || is_error_reported(),
   252            "bcp doesn't belong to this method: bcp: " INTPTR_FORMAT ", method: %s",
   250            "bcp doesn't belong to this method: bcp: " INTPTR_FORMAT ", method: %s",
   253            bcp, name_and_sig_as_C_string());
   251            p2i(bcp), name_and_sig_as_C_string());
   254   }
   252   }
   255 #endif
   253 #endif
   256   return bcp - code_base();
   254   return bcp - code_base();
   257 }
   255 }
   258 
   256 
  2024 void Method::print_on(outputStream* st) const {
  2022 void Method::print_on(outputStream* st) const {
  2025   ResourceMark rm;
  2023   ResourceMark rm;
  2026   assert(is_method(), "must be method");
  2024   assert(is_method(), "must be method");
  2027   st->print_cr("%s", internal_name());
  2025   st->print_cr("%s", internal_name());
  2028   // get the effect of PrintOopAddress, always, for methods:
  2026   // get the effect of PrintOopAddress, always, for methods:
  2029   st->print_cr(" - this oop:          " INTPTR_FORMAT, (intptr_t)this);
  2027   st->print_cr(" - this oop:          " INTPTR_FORMAT, p2i(this));
  2030   st->print   (" - method holder:     "); method_holder()->print_value_on(st); st->cr();
  2028   st->print   (" - method holder:     "); method_holder()->print_value_on(st); st->cr();
  2031   st->print   (" - constants:         " INTPTR_FORMAT " ", (address)constants());
  2029   st->print   (" - constants:         " INTPTR_FORMAT " ", p2i(constants()));
  2032   constants()->print_value_on(st); st->cr();
  2030   constants()->print_value_on(st); st->cr();
  2033   st->print   (" - access:            0x%x  ", access_flags().as_int()); access_flags().print_on(st); st->cr();
  2031   st->print   (" - access:            0x%x  ", access_flags().as_int()); access_flags().print_on(st); st->cr();
  2034   st->print   (" - name:              ");    name()->print_value_on(st); st->cr();
  2032   st->print   (" - name:              ");    name()->print_value_on(st); st->cr();
  2035   st->print   (" - signature:         ");    signature()->print_value_on(st); st->cr();
  2033   st->print   (" - signature:         ");    signature()->print_value_on(st); st->cr();
  2036   st->print_cr(" - max stack:         %d",   max_stack());
  2034   st->print_cr(" - max stack:         %d",   max_stack());
  2040   if (intrinsic_id() != vmIntrinsics::_none)
  2038   if (intrinsic_id() != vmIntrinsics::_none)
  2041     st->print_cr(" - intrinsic id:      %d %s", intrinsic_id(), vmIntrinsics::name_at(intrinsic_id()));
  2039     st->print_cr(" - intrinsic id:      %d %s", intrinsic_id(), vmIntrinsics::name_at(intrinsic_id()));
  2042   if (highest_comp_level() != CompLevel_none)
  2040   if (highest_comp_level() != CompLevel_none)
  2043     st->print_cr(" - highest level:     %d", highest_comp_level());
  2041     st->print_cr(" - highest level:     %d", highest_comp_level());
  2044   st->print_cr(" - vtable index:      %d",   _vtable_index);
  2042   st->print_cr(" - vtable index:      %d",   _vtable_index);
  2045   st->print_cr(" - i2i entry:         " INTPTR_FORMAT, interpreter_entry());
  2043   st->print_cr(" - i2i entry:         " INTPTR_FORMAT, p2i(interpreter_entry()));
  2046   st->print(   " - adapters:          ");
  2044   st->print(   " - adapters:          ");
  2047   AdapterHandlerEntry* a = ((Method*)this)->adapter();
  2045   AdapterHandlerEntry* a = ((Method*)this)->adapter();
  2048   if (a == NULL)
  2046   if (a == NULL)
  2049     st->print_cr(INTPTR_FORMAT, a);
  2047     st->print_cr(INTPTR_FORMAT, p2i(a));
  2050   else
  2048   else
  2051     a->print_adapter_on(st);
  2049     a->print_adapter_on(st);
  2052   st->print_cr(" - compiled entry     " INTPTR_FORMAT, from_compiled_entry());
  2050   st->print_cr(" - compiled entry     " INTPTR_FORMAT, p2i(from_compiled_entry()));
  2053   st->print_cr(" - code size:         %d",   code_size());
  2051   st->print_cr(" - code size:         %d",   code_size());
  2054   if (code_size() != 0) {
  2052   if (code_size() != 0) {
  2055     st->print_cr(" - code start:        " INTPTR_FORMAT, code_base());
  2053     st->print_cr(" - code start:        " INTPTR_FORMAT, p2i(code_base()));
  2056     st->print_cr(" - code end (excl):   " INTPTR_FORMAT, code_base() + code_size());
  2054     st->print_cr(" - code end (excl):   " INTPTR_FORMAT, p2i(code_base() + code_size()));
  2057   }
  2055   }
  2058   if (method_data() != NULL) {
  2056   if (method_data() != NULL) {
  2059     st->print_cr(" - method data:       " INTPTR_FORMAT, (address)method_data());
  2057     st->print_cr(" - method data:       " INTPTR_FORMAT, p2i(method_data()));
  2060   }
  2058   }
  2061   st->print_cr(" - checked ex length: %d",   checked_exceptions_length());
  2059   st->print_cr(" - checked ex length: %d",   checked_exceptions_length());
  2062   if (checked_exceptions_length() > 0) {
  2060   if (checked_exceptions_length() > 0) {
  2063     CheckedExceptionElement* table = checked_exceptions_start();
  2061     CheckedExceptionElement* table = checked_exceptions_start();
  2064     st->print_cr(" - checked ex start:  " INTPTR_FORMAT, table);
  2062     st->print_cr(" - checked ex start:  " INTPTR_FORMAT, p2i(table));
  2065     if (Verbose) {
  2063     if (Verbose) {
  2066       for (int i = 0; i < checked_exceptions_length(); i++) {
  2064       for (int i = 0; i < checked_exceptions_length(); i++) {
  2067         st->print_cr("   - throws %s", constants()->printable_name_at(table[i].class_cp_index));
  2065         st->print_cr("   - throws %s", constants()->printable_name_at(table[i].class_cp_index));
  2068       }
  2066       }
  2069     }
  2067     }
  2070   }
  2068   }
  2071   if (has_linenumber_table()) {
  2069   if (has_linenumber_table()) {
  2072     u_char* table = compressed_linenumber_table();
  2070     u_char* table = compressed_linenumber_table();
  2073     st->print_cr(" - linenumber start:  " INTPTR_FORMAT, table);
  2071     st->print_cr(" - linenumber start:  " INTPTR_FORMAT, p2i(table));
  2074     if (Verbose) {
  2072     if (Verbose) {
  2075       CompressedLineNumberReadStream stream(table);
  2073       CompressedLineNumberReadStream stream(table);
  2076       while (stream.read_pair()) {
  2074       while (stream.read_pair()) {
  2077         st->print_cr("   - line %d: %d", stream.line(), stream.bci());
  2075         st->print_cr("   - line %d: %d", stream.line(), stream.bci());
  2078       }
  2076       }
  2079     }
  2077     }
  2080   }
  2078   }
  2081   st->print_cr(" - localvar length:   %d",   localvariable_table_length());
  2079   st->print_cr(" - localvar length:   %d",   localvariable_table_length());
  2082   if (localvariable_table_length() > 0) {
  2080   if (localvariable_table_length() > 0) {
  2083     LocalVariableTableElement* table = localvariable_table_start();
  2081     LocalVariableTableElement* table = localvariable_table_start();
  2084     st->print_cr(" - localvar start:    " INTPTR_FORMAT, table);
  2082     st->print_cr(" - localvar start:    " INTPTR_FORMAT, p2i(table));
  2085     if (Verbose) {
  2083     if (Verbose) {
  2086       for (int i = 0; i < localvariable_table_length(); i++) {
  2084       for (int i = 0; i < localvariable_table_length(); i++) {
  2087         int bci = table[i].start_bci;
  2085         int bci = table[i].start_bci;
  2088         int len = table[i].length;
  2086         int len = table[i].length;
  2089         const char* name = constants()->printable_name_at(table[i].name_cp_index);
  2087         const char* name = constants()->printable_name_at(table[i].name_cp_index);
  2096   if (code() != NULL) {
  2094   if (code() != NULL) {
  2097     st->print   (" - compiled code: ");
  2095     st->print   (" - compiled code: ");
  2098     code()->print_value_on(st);
  2096     code()->print_value_on(st);
  2099   }
  2097   }
  2100   if (is_native()) {
  2098   if (is_native()) {
  2101     st->print_cr(" - native function:   " INTPTR_FORMAT, native_function());
  2099     st->print_cr(" - native function:   " INTPTR_FORMAT, p2i(native_function()));
  2102     st->print_cr(" - signature handler: " INTPTR_FORMAT, signature_handler());
  2100     st->print_cr(" - signature handler: " INTPTR_FORMAT, p2i(signature_handler()));
  2103   }
  2101   }
  2104 }
  2102 }
  2105 
  2103 
  2106 #endif //PRODUCT
  2104 #endif //PRODUCT
  2107 
  2105