hotspot/src/share/vm/code/codeBlob.cpp
changeset 6418 6671edbd230e
parent 6176 4d9030fe341f
child 6432 d36e09b60939
--- a/hotspot/src/share/vm/code/codeBlob.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/code/codeBlob.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -39,7 +39,7 @@
   size += round_to(cb->total_relocation_size(), oopSize);
   // align the size to CodeEntryAlignment
   size = align_code_offset(size);
-  size += round_to(cb->total_code_size(), oopSize);
+  size += round_to(cb->total_content_size(), oopSize);
   size += round_to(cb->total_oop_size(), oopSize);
   return size;
 }
@@ -47,8 +47,8 @@
 
 // Creates a simple CodeBlob. Sets up the size of the different regions.
 CodeBlob::CodeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size) {
-  assert(size == round_to(size, oopSize), "unaligned size");
-  assert(locs_size == round_to(locs_size, oopSize), "unaligned size");
+  assert(size        == round_to(size,        oopSize), "unaligned size");
+  assert(locs_size   == round_to(locs_size,   oopSize), "unaligned size");
   assert(header_size == round_to(header_size, oopSize), "unaligned size");
   assert(!UseRelocIndex, "no space allocated for reloc index yet");
 
@@ -64,7 +64,8 @@
   _frame_complete_offset = frame_complete;
   _header_size           = header_size;
   _relocation_size       = locs_size;
-  _instructions_offset   = align_code_offset(header_size + locs_size);
+  _content_offset        = align_code_offset(header_size + _relocation_size);
+  _code_offset           = _content_offset;
   _data_offset           = size;
   _frame_size            =  0;
   set_oop_maps(NULL);
@@ -82,7 +83,7 @@
   int         frame_size,
   OopMapSet*  oop_maps
 ) {
-  assert(size == round_to(size, oopSize), "unaligned size");
+  assert(size        == round_to(size,        oopSize), "unaligned size");
   assert(header_size == round_to(header_size, oopSize), "unaligned size");
 
   _name                  = name;
@@ -90,8 +91,9 @@
   _frame_complete_offset = frame_complete;
   _header_size           = header_size;
   _relocation_size       = round_to(cb->total_relocation_size(), oopSize);
-  _instructions_offset   = align_code_offset(header_size + _relocation_size);
-  _data_offset           = _instructions_offset + round_to(cb->total_code_size(), oopSize);
+  _content_offset        = align_code_offset(header_size + _relocation_size);
+  _code_offset           = _content_offset + cb->total_offset_of(cb->insts()->start());
+  _data_offset           = _content_offset + round_to(cb->total_content_size(), oopSize);
   assert(_data_offset <= size, "codeBlob is too small");
 
   cb->copy_code_and_locs_to(this);
@@ -127,9 +129,8 @@
 
 
 OopMap* CodeBlob::oop_map_for_return_address(address return_address) {
-  address pc = return_address ;
-  assert (oop_maps() != NULL, "nope");
-  return oop_maps()->find_map_at_offset ((intptr_t) pc - (intptr_t) instructions_begin());
+  assert(oop_maps() != NULL, "nope");
+  return oop_maps()->find_map_at_offset((intptr_t) return_address - (intptr_t) code_begin());
 }
 
 
@@ -284,12 +285,12 @@
     jio_snprintf(stub_id, sizeof(stub_id), "RuntimeStub - %s", stub_name);
     if (PrintStubCode) {
       tty->print_cr("Decoding %s " INTPTR_FORMAT, stub_id, stub);
-      Disassembler::decode(stub->instructions_begin(), stub->instructions_end());
+      Disassembler::decode(stub->code_begin(), stub->code_end());
     }
-    Forte::register_stub(stub_id, stub->instructions_begin(), stub->instructions_end());
+    Forte::register_stub(stub_id, stub->code_begin(), stub->code_end());
 
     if (JvmtiExport::should_post_dynamic_code_generated()) {
-      JvmtiExport::post_dynamic_code_generated(stub_name, stub->instructions_begin(), stub->instructions_end());
+      JvmtiExport::post_dynamic_code_generated(stub_name, stub->code_begin(), stub->code_end());
     }
   }
 
@@ -355,17 +356,15 @@
   // Do not hold the CodeCache lock during name formatting.
   if (blob != NULL) {
     char blob_id[256];
-    jio_snprintf(blob_id, sizeof(blob_id), "DeoptimizationBlob@" PTR_FORMAT, blob->instructions_begin());
+    jio_snprintf(blob_id, sizeof(blob_id), "DeoptimizationBlob@" PTR_FORMAT, blob->code_begin());
     if (PrintStubCode) {
       tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob);
-      Disassembler::decode(blob->instructions_begin(), blob->instructions_end());
+      Disassembler::decode(blob->code_begin(), blob->code_end());
     }
-    Forte::register_stub(blob_id, blob->instructions_begin(), blob->instructions_end());
+    Forte::register_stub(blob_id, blob->code_begin(), blob->code_end());
 
     if (JvmtiExport::should_post_dynamic_code_generated()) {
-      JvmtiExport::post_dynamic_code_generated("DeoptimizationBlob",
-                                               blob->instructions_begin(),
-                                               blob->instructions_end());
+      JvmtiExport::post_dynamic_code_generated("DeoptimizationBlob", blob->code_begin(), blob->code_end());
     }
   }
 
@@ -412,17 +411,15 @@
   // Do not hold the CodeCache lock during name formatting.
   if (blob != NULL) {
     char blob_id[256];
-    jio_snprintf(blob_id, sizeof(blob_id), "UncommonTrapBlob@" PTR_FORMAT, blob->instructions_begin());
+    jio_snprintf(blob_id, sizeof(blob_id), "UncommonTrapBlob@" PTR_FORMAT, blob->code_begin());
     if (PrintStubCode) {
       tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob);
-      Disassembler::decode(blob->instructions_begin(), blob->instructions_end());
+      Disassembler::decode(blob->code_begin(), blob->code_end());
     }
-    Forte::register_stub(blob_id, blob->instructions_begin(), blob->instructions_end());
+    Forte::register_stub(blob_id, blob->code_begin(), blob->code_end());
 
     if (JvmtiExport::should_post_dynamic_code_generated()) {
-      JvmtiExport::post_dynamic_code_generated("UncommonTrapBlob",
-                                               blob->instructions_begin(),
-                                               blob->instructions_end());
+      JvmtiExport::post_dynamic_code_generated("UncommonTrapBlob", blob->code_begin(), blob->code_end());
     }
   }
 
@@ -471,17 +468,15 @@
   // We do not need to hold the CodeCache lock during name formatting
   if (blob != NULL) {
     char blob_id[256];
-    jio_snprintf(blob_id, sizeof(blob_id), "ExceptionBlob@" PTR_FORMAT, blob->instructions_begin());
+    jio_snprintf(blob_id, sizeof(blob_id), "ExceptionBlob@" PTR_FORMAT, blob->code_begin());
     if (PrintStubCode) {
       tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob);
-      Disassembler::decode(blob->instructions_begin(), blob->instructions_end());
+      Disassembler::decode(blob->code_begin(), blob->code_end());
     }
-    Forte::register_stub(blob_id, blob->instructions_begin(), blob->instructions_end());
+    Forte::register_stub(blob_id, blob->code_begin(), blob->code_end());
 
     if (JvmtiExport::should_post_dynamic_code_generated()) {
-      JvmtiExport::post_dynamic_code_generated("ExceptionBlob",
-                                               blob->instructions_begin(),
-                                               blob->instructions_end());
+      JvmtiExport::post_dynamic_code_generated("ExceptionBlob", blob->code_begin(), blob->code_end());
     }
   }
 
@@ -529,17 +524,15 @@
   // We do not need to hold the CodeCache lock during name formatting.
   if (blob != NULL) {
     char blob_id[256];
-    jio_snprintf(blob_id, sizeof(blob_id), "SafepointBlob@" PTR_FORMAT, blob->instructions_begin());
+    jio_snprintf(blob_id, sizeof(blob_id), "SafepointBlob@" PTR_FORMAT, blob->code_begin());
     if (PrintStubCode) {
       tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob);
-      Disassembler::decode(blob->instructions_begin(), blob->instructions_end());
+      Disassembler::decode(blob->code_begin(), blob->code_end());
     }
-    Forte::register_stub(blob_id, blob->instructions_begin(), blob->instructions_end());
+    Forte::register_stub(blob_id, blob->code_begin(), blob->code_end());
 
     if (JvmtiExport::should_post_dynamic_code_generated()) {
-      JvmtiExport::post_dynamic_code_generated("SafepointBlob",
-                                               blob->instructions_begin(),
-                                               blob->instructions_end());
+      JvmtiExport::post_dynamic_code_generated("SafepointBlob", blob->code_begin(), blob->code_end());
     }
   }