< prev index next >

src/share/vm/asm/codeBuffer.cpp

Print this page

        

@@ -600,25 +600,23 @@
   csize_t csize = total_content_size();
   csize_t total = RelocIterator::locs_and_index_size(csize, lsize);
   return (csize_t) align_size_up(total, HeapWordSize);
 }
 
-csize_t CodeBuffer::copy_relocations_to(CodeBlob* dest) const {
-  address buf = NULL;
+csize_t CodeBuffer::copy_relocations_to(address buf, csize_t buf_limit, bool only_inst) const {
   csize_t buf_offset = 0;
-  csize_t buf_limit = 0;
-  if (dest != NULL) {
-    buf = (address)dest->relocation_begin();
-    buf_limit = (address)dest->relocation_end() - buf;
+  csize_t code_end_so_far = 0;
+  csize_t code_point_so_far = 0;
+
     assert((uintptr_t)buf % HeapWordSize == 0, "buf must be fully aligned");
     assert(buf_limit % HeapWordSize == 0, "buf must be evenly sized");
-  }
-  // if dest == NULL, this is just the sizing pass
 
-  csize_t code_end_so_far = 0;
-  csize_t code_point_so_far = 0;
   for (int n = (int) SECT_FIRST; n < (int)SECT_LIMIT; n++) {
+    if (only_inst && (n != (int)SECT_INSTS)) {
+      // Need only relocation info for code.
+      continue;
+    }
     // pull relocs out of each section
     const CodeSection* cs = code_section(n);
     assert(!(cs->is_empty() && cs->locs_count() > 0), "sanity");
     if (cs->is_empty())  continue;  // skip trivial section
     relocInfo* lstart = cs->locs_start();

@@ -681,11 +679,27 @@
       *(relocInfo*)(buf+buf_offset) = padding;
     }
     buf_offset += sizeof(relocInfo);
   }
 
-  assert(code_end_so_far == total_content_size(), "sanity");
+  assert(only_inst || code_end_so_far == total_content_size(), "sanity");
+
+  return buf_offset;
+}
+
+csize_t CodeBuffer::copy_relocations_to(CodeBlob* dest) const {
+  address buf = NULL;
+  csize_t buf_offset = 0;
+  csize_t buf_limit = 0;
+
+  if (dest != NULL) {
+    buf = (address)dest->relocation_begin();
+    buf_limit = (address)dest->relocation_end() - buf;
+  }
+  // if dest == NULL, this is just the sizing pass
+  //
+  buf_offset = copy_relocations_to(buf, buf_limit, false);
 
   // Account for index:
   if (buf != NULL) {
     RelocIterator::create_index(dest->relocation_begin(),
                                 buf_offset / sizeof(relocInfo),

@@ -1124,11 +1138,12 @@
     if (_strings != NULL) {
     CodeString* c = find(offset);
     while (c && c->offset() == offset) {
       stream->bol();
       stream->print("%s", _prefix);
-      stream->print_cr("%s", c->string());
+      // Don't interpret as format strings since it could contain %
+      stream->print_raw_cr(c->string());
       c = c->next_comment();
     }
   }
 }
 
< prev index next >