< prev index next >

src/hotspot/share/code/codeHeapState.cpp

Print this page




2067                 "  Due to the living nature of the code heap and because the CodeCache_lock\n"
2068                 "  is not continuously held, the displayed name might be wrong or no name\n"
2069                 "  might be found at all. The likelihood for that to happen increases\n"
2070                 "  over time passed between analysis and print step.\n");
2071   STRINGSTREAM_FLUSH_LOCKED("")
2072 
2073   for (unsigned int ix = 0; ix < alloc_granules; ix++) {
2074     //---<  print a new blob on a new line  >---
2075     if (ix%granules_per_line == 0) {
2076       if (!name_in_addr_range) {
2077         ast->print_cr("No methods, blobs, or stubs found in this address range");
2078       }
2079       name_in_addr_range = false;
2080 
2081       ast->cr();
2082       ast->print_cr("--------------------------------------------------------------------");
2083       ast->print_cr("Address range [%p,%p), " SIZE_FORMAT "k", low_bound+ix*granule_size, low_bound+(ix+granules_per_line)*granule_size, granules_per_line*granule_size/(size_t)K);
2084       ast->print_cr("--------------------------------------------------------------------");
2085       STRINGSTREAM_FLUSH_LOCKED("")
2086     }




2087     for (unsigned int is = 0; is < granule_size; is+=(unsigned int)seg_size) {

2088       CodeBlob* this_blob = (CodeBlob *)(heap->find_start(low_bound+ix*granule_size+is));
2089       if ((this_blob != NULL) && (this_blob != last_blob)) {



2090         if (!name_in_addr_range) {
2091           name_in_addr_range = true;
2092           ast->fill_to(51);
2093           ast->print("%9s", "compiler");
2094           ast->fill_to(61);
2095           ast->print_cr("%6s", "method");
2096           ast->print_cr("%18s %13s %17s %9s  %5s %18s  %s", "Addr(module)      ", "offset", "size", " type lvl", " temp", "blobType          ", "Name");
2097         }
2098 
2099         //---<  Print blobTypeName as recorded during analysis  >---
2100         ast->print("%p", this_blob);
2101         ast->fill_to(19);
2102         ast->print("(+" PTR32_FORMAT ")", (unsigned int)((char*)this_blob-low_bound));
2103         ast->fill_to(33);
2104 
2105         //---<  print size, name, and signature (for nMethods)  >---
2106         const char *blob_name = this_blob->name();





2107         nmethod*           nm = this_blob->as_nmethod_or_null();
2108         blobType       cbType = noType;
2109         if (segment_granules) {
2110           cbType = (blobType)StatArray[ix].type;
2111         } else {
2112           cbType = get_cbType(this_blob);
2113         }
2114         if ((nm != NULL) && (nm->method() != NULL)) {
2115           ResourceMark rm;
2116           //---<  nMethod size in hex  >---
2117           unsigned int total_size = nm->total_size();
2118           ast->print(PTR32_FORMAT, total_size);
2119           ast->print("(" SIZE_FORMAT_W(4) "K)", total_size/K);
2120           //---<  compiler information  >---
2121           ast->fill_to(51);
2122           ast->print("%5s %3d", compTypeName[StatArray[ix].compiler], StatArray[ix].level);
2123           //---<  method temperature  >---
2124           ast->fill_to(62);
2125           ast->print("%5d", nm->hotness_counter());
2126           //---<  name and signature  >---


2128           ast->print("%s", blobTypeName[cbType]);
2129           ast->fill_to(82+6);
2130           if (nm->is_in_use()) {
2131             blob_name = nm->method()->name_and_sig_as_C_string();
2132           }
2133           if (nm->is_not_entrant()) {
2134             blob_name = nm->method()->name_and_sig_as_C_string();
2135           }
2136           if (nm->is_zombie()) {
2137             ast->print("%14s", " zombie method");
2138           }
2139           ast->print("%s", blob_name);
2140         } else {
2141           ast->fill_to(62+6);
2142           ast->print("%s", blobTypeName[cbType]);
2143           ast->fill_to(82+6);
2144           ast->print("%s", blob_name);
2145         }
2146         STRINGSTREAM_FLUSH_LOCKED("\n")
2147         last_blob          = this_blob;



2148       }
2149     }
2150   }
2151   STRINGSTREAM_FLUSH_LOCKED("\n\n")
2152 }
2153 
2154 
2155 void CodeHeapState::printBox(outputStream* ast, const char border, const char* text1, const char* text2) {
2156   unsigned int lineLen = 1 + 2 + 2 + 1;
2157   char edge, frame;
2158 
2159   if (text1 != NULL) {
2160     lineLen += (unsigned int)strlen(text1); // text1 is much shorter than MAX_INT chars.
2161   }
2162   if (text2 != NULL) {
2163     lineLen += (unsigned int)strlen(text2); // text2 is much shorter than MAX_INT chars.
2164   }
2165   if (border == '-') {
2166     edge  = '+';
2167     frame = '|';




2067                 "  Due to the living nature of the code heap and because the CodeCache_lock\n"
2068                 "  is not continuously held, the displayed name might be wrong or no name\n"
2069                 "  might be found at all. The likelihood for that to happen increases\n"
2070                 "  over time passed between analysis and print step.\n");
2071   STRINGSTREAM_FLUSH_LOCKED("")
2072 
2073   for (unsigned int ix = 0; ix < alloc_granules; ix++) {
2074     //---<  print a new blob on a new line  >---
2075     if (ix%granules_per_line == 0) {
2076       if (!name_in_addr_range) {
2077         ast->print_cr("No methods, blobs, or stubs found in this address range");
2078       }
2079       name_in_addr_range = false;
2080 
2081       ast->cr();
2082       ast->print_cr("--------------------------------------------------------------------");
2083       ast->print_cr("Address range [%p,%p), " SIZE_FORMAT "k", low_bound+ix*granule_size, low_bound+(ix+granules_per_line)*granule_size, granules_per_line*granule_size/(size_t)K);
2084       ast->print_cr("--------------------------------------------------------------------");
2085       STRINGSTREAM_FLUSH_LOCKED("")
2086     }
2087     // Only check granule if it contains at least one blob.
2088     unsigned int nBlobs  = StatArray[ix].t1_count   + StatArray[ix].t2_count + StatArray[ix].tx_count +
2089                            StatArray[ix].stub_count + StatArray[ix].dead_count;
2090     if (nBlobs > 0 ) {
2091     for (unsigned int is = 0; is < granule_size; is+=(unsigned int)seg_size) {
2092       // heap->find_start() is safe. Only working with _segmap. Returns NULL or void*. Returned CodeBlob may be uninitialized.
2093       CodeBlob* this_blob = (CodeBlob *)(heap->find_start(low_bound+ix*granule_size+is));
2094       bool blob_initialized = (this_blob != NULL) &&
2095                               ((char*)this_blob + this_blob->header_size() == (char*)(this_blob->relocation_begin())) &&
2096                               ((char*)this_blob + CodeBlob::align_code_offset(this_blob->header_size() + this_blob->relocation_size()) == (char*)(this_blob->content_begin()));
2097       if (blob_initialized && (this_blob != last_blob)) {
2098         if (!name_in_addr_range) {
2099           name_in_addr_range = true;
2100           ast->fill_to(51);
2101           ast->print("%9s", "compiler");
2102           ast->fill_to(61);
2103           ast->print_cr("%6s", "method");
2104           ast->print_cr("%18s %13s %17s %9s  %5s %18s  %s", "Addr(module)      ", "offset", "size", " type lvl", " temp", "blobType          ", "Name");
2105         }
2106 
2107         //---<  Print blobTypeName as recorded during analysis  >---
2108         ast->print("%p", this_blob);
2109         ast->fill_to(19);
2110         ast->print("(+" PTR32_FORMAT ")", (unsigned int)((char*)this_blob-low_bound));
2111         ast->fill_to(33);
2112 
2113         //---<  print size, name, and signature (for nMethods)  >---
2114         // this_blob->name() could return NULL if no name is given to CTOR. Inlined, maybe not visible on stack
2115         const char* blob_name = this_blob->name();
2116         if (blob_name == 0) {
2117           blob_name = "<unavailable>";
2118         }
2119         // this_blob->as_nmethod_or_null() is safe. Inlined, maybe not visible on stack.
2120         nmethod*           nm = this_blob->as_nmethod_or_null();
2121         blobType       cbType = noType;
2122         if (segment_granules) {
2123           cbType = (blobType)StatArray[ix].type;
2124         } else {
2125           cbType = get_cbType(this_blob);
2126         }
2127         if ((nm != NULL) && (nm->method() != NULL)) {
2128           ResourceMark rm;
2129           //---<  nMethod size in hex  >---
2130           unsigned int total_size = nm->total_size();
2131           ast->print(PTR32_FORMAT, total_size);
2132           ast->print("(" SIZE_FORMAT_W(4) "K)", total_size/K);
2133           //---<  compiler information  >---
2134           ast->fill_to(51);
2135           ast->print("%5s %3d", compTypeName[StatArray[ix].compiler], StatArray[ix].level);
2136           //---<  method temperature  >---
2137           ast->fill_to(62);
2138           ast->print("%5d", nm->hotness_counter());
2139           //---<  name and signature  >---


2141           ast->print("%s", blobTypeName[cbType]);
2142           ast->fill_to(82+6);
2143           if (nm->is_in_use()) {
2144             blob_name = nm->method()->name_and_sig_as_C_string();
2145           }
2146           if (nm->is_not_entrant()) {
2147             blob_name = nm->method()->name_and_sig_as_C_string();
2148           }
2149           if (nm->is_zombie()) {
2150             ast->print("%14s", " zombie method");
2151           }
2152           ast->print("%s", blob_name);
2153         } else {
2154           ast->fill_to(62+6);
2155           ast->print("%s", blobTypeName[cbType]);
2156           ast->fill_to(82+6);
2157           ast->print("%s", blob_name);
2158         }
2159         STRINGSTREAM_FLUSH_LOCKED("\n")
2160         last_blob          = this_blob;
2161       } else if (!blob_initialized && (this_blob != NULL)) {
2162         last_blob          = this_blob;
2163       }
2164     }
2165     }
2166   }
2167   STRINGSTREAM_FLUSH_LOCKED("\n\n")
2168 }
2169 
2170 
2171 void CodeHeapState::printBox(outputStream* ast, const char border, const char* text1, const char* text2) {
2172   unsigned int lineLen = 1 + 2 + 2 + 1;
2173   char edge, frame;
2174 
2175   if (text1 != NULL) {
2176     lineLen += (unsigned int)strlen(text1); // text1 is much shorter than MAX_INT chars.
2177   }
2178   if (text2 != NULL) {
2179     lineLen += (unsigned int)strlen(text2); // text2 is much shorter than MAX_INT chars.
2180   }
2181   if (border == '-') {
2182     edge  = '+';
2183     frame = '|';


< prev index next >