comparison src/share/vm/compiler/disassembler.cpp @ 8883:b9a918201d47

Merge with hsx25
author Gilles Duboscq <duboscq@ssw.jku.at>
date Sat, 06 Apr 2013 20:04:06 +0200
parents 7ead04aea1e4 a5de0cc2f91c
children d8041d695d19
comparison
equal deleted inserted replaced
8660:d47b52b0ff68 8883:b9a918201d47
156 156
157 class decode_env { 157 class decode_env {
158 private: 158 private:
159 nmethod* _nm; 159 nmethod* _nm;
160 CodeBlob* _code; 160 CodeBlob* _code;
161 CodeComments _comments; 161 CodeStrings _strings;
162 outputStream* _output; 162 outputStream* _output;
163 address _start, _end; 163 address _start, _end;
164 164
165 char _option_buf[512]; 165 char _option_buf[512];
166 char _print_raw; 166 char _print_raw;
196 void print_insn_labels(); 196 void print_insn_labels();
197 void print_insn_bytes(address pc0, address pc); 197 void print_insn_bytes(address pc0, address pc);
198 void print_address(address value); 198 void print_address(address value);
199 199
200 public: 200 public:
201 decode_env(CodeBlob* code, outputStream* output, CodeComments c = CodeComments()); 201 decode_env(CodeBlob* code, outputStream* output, CodeStrings c = CodeStrings());
202 202
203 address decode_instructions(address start, address end); 203 address decode_instructions(address start, address end);
204 204
205 void start_insn(address pc) { 205 void start_insn(address pc) {
206 _cur_insn = pc; 206 _cur_insn = pc;
240 int total_ticks() { return _total_ticks; } 240 int total_ticks() { return _total_ticks; }
241 void set_total_ticks(int n) { _total_ticks = n; } 241 void set_total_ticks(int n) { _total_ticks = n; }
242 const char* options() { return _option_buf; } 242 const char* options() { return _option_buf; }
243 }; 243 };
244 244
245 decode_env::decode_env(CodeBlob* code, outputStream* output, CodeComments c) { 245 decode_env::decode_env(CodeBlob* code, outputStream* output, CodeStrings c) {
246 memset(this, 0, sizeof(*this)); 246 memset(this, 0, sizeof(*this));
247 _output = output ? output : tty; 247 _output = output ? output : tty;
248 _code = code; 248 _code = code;
249 if (code != NULL && code->is_nmethod()) 249 if (code != NULL && code->is_nmethod())
250 _nm = (nmethod*) code; 250 _nm = (nmethod*) code;
251 _comments.assign(c); 251 _strings.assign(c);
252 252
253 // by default, output pc but not bytes: 253 // by default, output pc but not bytes:
254 _print_pc = true; 254 _print_pc = true;
255 _print_bytes = false; 255 _print_bytes = false;
256 _bytes_per_line = Disassembler::pd_instruction_alignment(); 256 _bytes_per_line = Disassembler::pd_instruction_alignment();
368 outputStream* st = output(); 368 outputStream* st = output();
369 CodeBlob* cb = _code; 369 CodeBlob* cb = _code;
370 if (cb != NULL) { 370 if (cb != NULL) {
371 cb->print_block_comment(st, p); 371 cb->print_block_comment(st, p);
372 } 372 }
373 _comments.print_block_comment(st, (intptr_t)(p - _start)); 373 _strings.print_block_comment(st, (intptr_t)(p - _start));
374 if (_print_pc) { 374 if (_print_pc) {
375 st->print(" " PTR_FORMAT ": ", p); 375 st->print(" " PTR_FORMAT ": ", p);
376 } 376 }
377 } 377 }
378 378
497 env.output()->print_cr("----------------------------------------------------------------------"); 497 env.output()->print_cr("----------------------------------------------------------------------");
498 env.output()->print_cr("%s at [" PTR_FORMAT ", " PTR_FORMAT "] %d bytes", cb->name(), cb->code_begin(), cb->code_end(), ((jlong)(cb->code_end() - cb->code_begin())) * sizeof(unsigned char*)); 498 env.output()->print_cr("%s at [" PTR_FORMAT ", " PTR_FORMAT "] %d bytes", cb->name(), cb->code_begin(), cb->code_end(), ((jlong)(cb->code_end() - cb->code_begin())) * sizeof(unsigned char*));
499 env.decode_instructions(cb->code_begin(), cb->code_end()); 499 env.decode_instructions(cb->code_begin(), cb->code_end());
500 } 500 }
501 501
502 void Disassembler::decode(address start, address end, outputStream* st, CodeComments c) { 502 void Disassembler::decode(address start, address end, outputStream* st, CodeStrings c) {
503 if (!load_library()) return; 503 if (!load_library()) return;
504 decode_env env(CodeCache::find_blob_unsafe(start), st, c); 504 decode_env env(CodeCache::find_blob_unsafe(start), st, c);
505 env.decode_instructions(start, end); 505 env.decode_instructions(start, end);
506 } 506 }
507 507