hotspot/src/share/vm/asm/codeBuffer.cpp
changeset 33160 c59f1676d27e
parent 31599 f1b42743d3ee
child 33593 60764a78fa5c
--- a/hotspot/src/share/vm/asm/codeBuffer.cpp	Thu Oct 08 10:25:45 2015 +0000
+++ b/hotspot/src/share/vm/asm/codeBuffer.cpp	Thu Oct 08 12:49:30 2015 -1000
@@ -602,21 +602,19 @@
   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;
-    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;
+
+  assert((uintptr_t)buf % HeapWordSize == 0, "buf must be fully aligned");
+  assert(buf_limit % HeapWordSize == 0, "buf must be evenly sized");
+
   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");
@@ -683,7 +681,23 @@
     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) {
@@ -1126,7 +1140,8 @@
     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();
     }
   }