1.1 --- a/src/share/vm/code/codeBlob.cpp Mon Aug 23 09:09:36 2010 -0700 1.2 +++ b/src/share/vm/code/codeBlob.cpp Wed Aug 25 05:27:54 2010 -0700 1.3 @@ -39,7 +39,7 @@ 1.4 size += round_to(cb->total_relocation_size(), oopSize); 1.5 // align the size to CodeEntryAlignment 1.6 size = align_code_offset(size); 1.7 - size += round_to(cb->total_code_size(), oopSize); 1.8 + size += round_to(cb->total_content_size(), oopSize); 1.9 size += round_to(cb->total_oop_size(), oopSize); 1.10 return size; 1.11 } 1.12 @@ -47,8 +47,8 @@ 1.13 1.14 // Creates a simple CodeBlob. Sets up the size of the different regions. 1.15 CodeBlob::CodeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size) { 1.16 - assert(size == round_to(size, oopSize), "unaligned size"); 1.17 - assert(locs_size == round_to(locs_size, oopSize), "unaligned size"); 1.18 + assert(size == round_to(size, oopSize), "unaligned size"); 1.19 + assert(locs_size == round_to(locs_size, oopSize), "unaligned size"); 1.20 assert(header_size == round_to(header_size, oopSize), "unaligned size"); 1.21 assert(!UseRelocIndex, "no space allocated for reloc index yet"); 1.22 1.23 @@ -64,7 +64,8 @@ 1.24 _frame_complete_offset = frame_complete; 1.25 _header_size = header_size; 1.26 _relocation_size = locs_size; 1.27 - _instructions_offset = align_code_offset(header_size + locs_size); 1.28 + _content_offset = align_code_offset(header_size + _relocation_size); 1.29 + _code_offset = _content_offset; 1.30 _data_offset = size; 1.31 _frame_size = 0; 1.32 set_oop_maps(NULL); 1.33 @@ -82,7 +83,7 @@ 1.34 int frame_size, 1.35 OopMapSet* oop_maps 1.36 ) { 1.37 - assert(size == round_to(size, oopSize), "unaligned size"); 1.38 + assert(size == round_to(size, oopSize), "unaligned size"); 1.39 assert(header_size == round_to(header_size, oopSize), "unaligned size"); 1.40 1.41 _name = name; 1.42 @@ -90,8 +91,9 @@ 1.43 _frame_complete_offset = frame_complete; 1.44 _header_size = header_size; 1.45 _relocation_size = round_to(cb->total_relocation_size(), oopSize); 1.46 - _instructions_offset = align_code_offset(header_size + _relocation_size); 1.47 - _data_offset = _instructions_offset + round_to(cb->total_code_size(), oopSize); 1.48 + _content_offset = align_code_offset(header_size + _relocation_size); 1.49 + _code_offset = _content_offset + cb->total_offset_of(cb->insts()->start()); 1.50 + _data_offset = _content_offset + round_to(cb->total_content_size(), oopSize); 1.51 assert(_data_offset <= size, "codeBlob is too small"); 1.52 1.53 cb->copy_code_and_locs_to(this); 1.54 @@ -127,9 +129,8 @@ 1.55 1.56 1.57 OopMap* CodeBlob::oop_map_for_return_address(address return_address) { 1.58 - address pc = return_address ; 1.59 - assert (oop_maps() != NULL, "nope"); 1.60 - return oop_maps()->find_map_at_offset ((intptr_t) pc - (intptr_t) instructions_begin()); 1.61 + assert(oop_maps() != NULL, "nope"); 1.62 + return oop_maps()->find_map_at_offset((intptr_t) return_address - (intptr_t) code_begin()); 1.63 } 1.64 1.65 1.66 @@ -284,12 +285,12 @@ 1.67 jio_snprintf(stub_id, sizeof(stub_id), "RuntimeStub - %s", stub_name); 1.68 if (PrintStubCode) { 1.69 tty->print_cr("Decoding %s " INTPTR_FORMAT, stub_id, stub); 1.70 - Disassembler::decode(stub->instructions_begin(), stub->instructions_end()); 1.71 + Disassembler::decode(stub->code_begin(), stub->code_end()); 1.72 } 1.73 - Forte::register_stub(stub_id, stub->instructions_begin(), stub->instructions_end()); 1.74 + Forte::register_stub(stub_id, stub->code_begin(), stub->code_end()); 1.75 1.76 if (JvmtiExport::should_post_dynamic_code_generated()) { 1.77 - JvmtiExport::post_dynamic_code_generated(stub_name, stub->instructions_begin(), stub->instructions_end()); 1.78 + JvmtiExport::post_dynamic_code_generated(stub_name, stub->code_begin(), stub->code_end()); 1.79 } 1.80 } 1.81 1.82 @@ -355,17 +356,15 @@ 1.83 // Do not hold the CodeCache lock during name formatting. 1.84 if (blob != NULL) { 1.85 char blob_id[256]; 1.86 - jio_snprintf(blob_id, sizeof(blob_id), "DeoptimizationBlob@" PTR_FORMAT, blob->instructions_begin()); 1.87 + jio_snprintf(blob_id, sizeof(blob_id), "DeoptimizationBlob@" PTR_FORMAT, blob->code_begin()); 1.88 if (PrintStubCode) { 1.89 tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob); 1.90 - Disassembler::decode(blob->instructions_begin(), blob->instructions_end()); 1.91 + Disassembler::decode(blob->code_begin(), blob->code_end()); 1.92 } 1.93 - Forte::register_stub(blob_id, blob->instructions_begin(), blob->instructions_end()); 1.94 + Forte::register_stub(blob_id, blob->code_begin(), blob->code_end()); 1.95 1.96 if (JvmtiExport::should_post_dynamic_code_generated()) { 1.97 - JvmtiExport::post_dynamic_code_generated("DeoptimizationBlob", 1.98 - blob->instructions_begin(), 1.99 - blob->instructions_end()); 1.100 + JvmtiExport::post_dynamic_code_generated("DeoptimizationBlob", blob->code_begin(), blob->code_end()); 1.101 } 1.102 } 1.103 1.104 @@ -412,17 +411,15 @@ 1.105 // Do not hold the CodeCache lock during name formatting. 1.106 if (blob != NULL) { 1.107 char blob_id[256]; 1.108 - jio_snprintf(blob_id, sizeof(blob_id), "UncommonTrapBlob@" PTR_FORMAT, blob->instructions_begin()); 1.109 + jio_snprintf(blob_id, sizeof(blob_id), "UncommonTrapBlob@" PTR_FORMAT, blob->code_begin()); 1.110 if (PrintStubCode) { 1.111 tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob); 1.112 - Disassembler::decode(blob->instructions_begin(), blob->instructions_end()); 1.113 + Disassembler::decode(blob->code_begin(), blob->code_end()); 1.114 } 1.115 - Forte::register_stub(blob_id, blob->instructions_begin(), blob->instructions_end()); 1.116 + Forte::register_stub(blob_id, blob->code_begin(), blob->code_end()); 1.117 1.118 if (JvmtiExport::should_post_dynamic_code_generated()) { 1.119 - JvmtiExport::post_dynamic_code_generated("UncommonTrapBlob", 1.120 - blob->instructions_begin(), 1.121 - blob->instructions_end()); 1.122 + JvmtiExport::post_dynamic_code_generated("UncommonTrapBlob", blob->code_begin(), blob->code_end()); 1.123 } 1.124 } 1.125 1.126 @@ -471,17 +468,15 @@ 1.127 // We do not need to hold the CodeCache lock during name formatting 1.128 if (blob != NULL) { 1.129 char blob_id[256]; 1.130 - jio_snprintf(blob_id, sizeof(blob_id), "ExceptionBlob@" PTR_FORMAT, blob->instructions_begin()); 1.131 + jio_snprintf(blob_id, sizeof(blob_id), "ExceptionBlob@" PTR_FORMAT, blob->code_begin()); 1.132 if (PrintStubCode) { 1.133 tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob); 1.134 - Disassembler::decode(blob->instructions_begin(), blob->instructions_end()); 1.135 + Disassembler::decode(blob->code_begin(), blob->code_end()); 1.136 } 1.137 - Forte::register_stub(blob_id, blob->instructions_begin(), blob->instructions_end()); 1.138 + Forte::register_stub(blob_id, blob->code_begin(), blob->code_end()); 1.139 1.140 if (JvmtiExport::should_post_dynamic_code_generated()) { 1.141 - JvmtiExport::post_dynamic_code_generated("ExceptionBlob", 1.142 - blob->instructions_begin(), 1.143 - blob->instructions_end()); 1.144 + JvmtiExport::post_dynamic_code_generated("ExceptionBlob", blob->code_begin(), blob->code_end()); 1.145 } 1.146 } 1.147 1.148 @@ -529,17 +524,15 @@ 1.149 // We do not need to hold the CodeCache lock during name formatting. 1.150 if (blob != NULL) { 1.151 char blob_id[256]; 1.152 - jio_snprintf(blob_id, sizeof(blob_id), "SafepointBlob@" PTR_FORMAT, blob->instructions_begin()); 1.153 + jio_snprintf(blob_id, sizeof(blob_id), "SafepointBlob@" PTR_FORMAT, blob->code_begin()); 1.154 if (PrintStubCode) { 1.155 tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob); 1.156 - Disassembler::decode(blob->instructions_begin(), blob->instructions_end()); 1.157 + Disassembler::decode(blob->code_begin(), blob->code_end()); 1.158 } 1.159 - Forte::register_stub(blob_id, blob->instructions_begin(), blob->instructions_end()); 1.160 + Forte::register_stub(blob_id, blob->code_begin(), blob->code_end()); 1.161 1.162 if (JvmtiExport::should_post_dynamic_code_generated()) { 1.163 - JvmtiExport::post_dynamic_code_generated("SafepointBlob", 1.164 - blob->instructions_begin(), 1.165 - blob->instructions_end()); 1.166 + JvmtiExport::post_dynamic_code_generated("SafepointBlob", blob->code_begin(), blob->code_end()); 1.167 } 1.168 } 1.169