< prev index next >

src/hotspot/share/asm/codeBuffer.cpp

Print this page
@@ -27,10 +27,11 @@
  #include "code/compiledIC.hpp"
  #include "code/oopRecorder.inline.hpp"
  #include "compiler/disassembler.hpp"
  #include "logging/log.hpp"
  #include "oops/klass.inline.hpp"
+ #include "oops/methodCounters.hpp"
  #include "oops/methodData.hpp"
  #include "oops/oop.inline.hpp"
  #include "runtime/icache.hpp"
  #include "runtime/safepointVerifiers.hpp"
  #include "utilities/align.hpp"

@@ -534,10 +535,13 @@
            Metadata* m = md->metadata_value();
            if (oop_recorder()->is_real(m)) {
              if (m->is_methodData()) {
                m = ((MethodData*)m)->method();
              }
+             if (m->is_methodCounters()) {
+               m = ((MethodCounters*)m)->method();
+             }
              if (m->is_method()) {
                m = ((Method*)m)->method_holder();
              }
              if (m->is_klass()) {
                append_oop_references(&oops, (Klass*)m);

@@ -558,10 +562,13 @@
        Metadata* m = oop_recorder()->metadata_at(i);
        if (oop_recorder()->is_real(m)) {
          if (m->is_methodData()) {
            m = ((MethodData*)m)->method();
          }
+         if (m->is_methodCounters()) {
+           m = ((MethodCounters*)m)->method();
+         }
          if (m->is_method()) {
            m = ((Method*)m)->method_holder();
          }
          if (m->is_klass()) {
            append_oop_references(&oops, (Klass*)m);

@@ -720,11 +727,11 @@
  
  void CodeBuffer::copy_code_to(CodeBlob* dest_blob) {
  #ifndef PRODUCT
    if (PrintNMethods && (WizardMode || Verbose)) {
      tty->print("done with CodeBuffer:");
-     ((CodeBuffer*)this)->print();
+     ((CodeBuffer*)this)->print_on(tty);
    }
  #endif //PRODUCT
  
    CodeBuffer dest(dest_blob);
    assert(dest_blob->content_size() >= total_content_size(), "good sizing");

@@ -861,11 +868,11 @@
  
  void CodeBuffer::expand(CodeSection* which_cs, csize_t amount) {
  #ifndef PRODUCT
    if (PrintNMethods && (WizardMode || Verbose)) {
      tty->print("expanding CodeBuffer:");
-     this->print();
+     this->print_on(tty);
    }
  
    if (StressCodeBuffers && blob() != nullptr) {
      static int expand_count = 0;
      if (expand_count >= 0)  expand_count += 1;

@@ -944,11 +951,11 @@
  
  #ifndef PRODUCT
    _decode_begin = nullptr;  // sanity
    if (PrintNMethods && (WizardMode || Verbose)) {
      tty->print("expanded CodeBuffer:");
-     this->print();
+     this->print_on(tty);
    }
  #endif //PRODUCT
  }
  
  void CodeBuffer::take_over_code_from(CodeBuffer* cb) {

@@ -989,27 +996,27 @@
        if (!other->is_allocated() || other == sect) {
          continue;
        }
        guarantee(other->disjoint(sect), "sanity");
      }
-     guarantee(sect->end() <= tend, "sanity");
-     guarantee(sect->end() <= sect->limit(), "sanity");
+     guarantee(sect->end() <= tend, "sanity, sect_end: " PTR_FORMAT " tend: " PTR_FORMAT " size: %d", p2i(sect->end()), p2i(tend), (int)_total_size);
+     guarantee(sect->end() <= sect->limit(), "sanity, sect_end: " PTR_FORMAT " sect_limit: " PTR_FORMAT, p2i(sect->end()), p2i(sect->limit()));
    }
  }
  
  void CodeBuffer::log_section_sizes(const char* name) {
    if (xtty != nullptr) {
      ttyLocker ttyl;
      // log info about buffer usage
-     xtty->print_cr("<blob name='%s' total_size='%d'>", name, _total_size);
+     xtty->head("blob name='%s' total_size='%d'", name, _total_size);
      for (int n = (int) CodeBuffer::SECT_FIRST; n < (int) CodeBuffer::SECT_LIMIT; n++) {
        CodeSection* sect = code_section(n);
        if (!sect->is_allocated() || sect->is_empty())  continue;
-       xtty->print_cr("<sect index='%d' capacity='%d' size='%d' remaining='%d'/>",
-                      n, sect->capacity(), sect->size(), sect->remaining());
+       xtty->elem("sect index='%d' capacity='%d' size='%d' remaining='%d'",
+                  n, sect->capacity(), sect->size(), sect->remaining());
      }
-     xtty->print_cr("</blob>");
+     xtty->tail("blob");
    }
  }
  
  bool CodeBuffer::finalize_stubs() {
    if (_finalize_stubs && !pd_finalize_stubs()) {

@@ -1047,28 +1054,35 @@
    ttyLocker ttyl;
    Disassembler::decode(decode_begin(), insts_end(), tty NOT_PRODUCT(COMMA &asm_remarks()));
    _decode_begin = insts_end();
  }
  
- void CodeSection::print(const char* name) {
+ void CodeSection::print_on(outputStream* st, const char* name) {
    csize_t locs_size = locs_end() - locs_start();
-   tty->print_cr(" %7s.code = " PTR_FORMAT " : " PTR_FORMAT " : " PTR_FORMAT " (%d of %d)",
-                 name, p2i(start()), p2i(end()), p2i(limit()), size(), capacity());
-   tty->print_cr(" %7s.locs = " PTR_FORMAT " : " PTR_FORMAT " : " PTR_FORMAT " (%d of %d) point=%d",
-                 name, p2i(locs_start()), p2i(locs_end()), p2i(locs_limit()), locs_size, locs_capacity(), locs_point_off());
+   st->print_cr(" %7s.code = " PTR_FORMAT " : " PTR_FORMAT " : " PTR_FORMAT " (%d of %d)",
+                name, p2i(start()), p2i(end()), p2i(limit()), size(), capacity());
+   st->print_cr(" %7s.locs = " PTR_FORMAT " : " PTR_FORMAT " : " PTR_FORMAT " (%d of %d) point=%d",
+                name, p2i(locs_start()), p2i(locs_end()), p2i(locs_limit()), locs_size, locs_capacity(), locs_point_off());
    if (PrintRelocations) {
      RelocIterator iter(this);
-     iter.print();
+     iter.print_on(st);
    }
  }
  
- void CodeBuffer::print() {
-   tty->print_cr("CodeBuffer:");
+ void CodeBuffer::print_on(outputStream* st) {
+ #if 0
+   if (this == nullptr) { // gcc complains 'nonnull' argument 'this' compared to NULL 
+     st->print_cr("null CodeBuffer pointer");
+     return;
+   }
+ #endif
+ 
+   st->print_cr("CodeBuffer:%s", name());
    for (int n = 0; n < (int)SECT_LIMIT; n++) {
      // print each section
      CodeSection* cs = code_section(n);
-     cs->print(code_section_name(n));
+     cs->print_on(st, code_section_name(n));
    }
  }
  
  // ----- CHeapString -----------------------------------------------------------
  
< prev index next >