406 void Disassembler::decode(CodeBlob* cb, outputStream* st) { 407 if (!load_library()) return; 408 decode_env env(cb, st); 409 env.output()->print_cr("Decoding CodeBlob " INTPTR_FORMAT, cb); 410 env.decode_instructions(cb->instructions_begin(), cb->instructions_end()); 411 } 412 413 414 void Disassembler::decode(address start, address end, outputStream* st) { 415 if (!load_library()) return; 416 decode_env env(CodeCache::find_blob_unsafe(start), st); 417 env.decode_instructions(start, end); 418 } 419 420 void Disassembler::decode(nmethod* nm, outputStream* st) { 421 if (!load_library()) return; 422 decode_env env(nm, st); 423 env.output()->print_cr("Decoding compiled method " INTPTR_FORMAT ":", nm); 424 env.output()->print_cr("Code:"); 425 426 unsigned char* p = nm->instructions_begin(); 427 unsigned char* end = nm->instructions_end(); 428 429 // If there has been profiling, print the buckets. 430 if (FlatProfiler::bucket_start_for(p) != NULL) { 431 unsigned char* p1 = p; 432 int total_bucket_count = 0; 433 while (p1 < end) { 434 unsigned char* p0 = p1; 435 p1 += pd_instruction_alignment(); 436 address bucket_pc = FlatProfiler::bucket_start_for(p1); 437 if (bucket_pc != NULL && bucket_pc > p0 && bucket_pc <= p1) 438 total_bucket_count += FlatProfiler::bucket_count_for(p0); 439 } 440 env.set_total_ticks(total_bucket_count); 441 } 442 443 env.decode_instructions(p, end); 444 } | 406 void Disassembler::decode(CodeBlob* cb, outputStream* st) { 407 if (!load_library()) return; 408 decode_env env(cb, st); 409 env.output()->print_cr("Decoding CodeBlob " INTPTR_FORMAT, cb); 410 env.decode_instructions(cb->instructions_begin(), cb->instructions_end()); 411 } 412 413 414 void Disassembler::decode(address start, address end, outputStream* st) { 415 if (!load_library()) return; 416 decode_env env(CodeCache::find_blob_unsafe(start), st); 417 env.decode_instructions(start, end); 418 } 419 420 void Disassembler::decode(nmethod* nm, outputStream* st) { 421 if (!load_library()) return; 422 decode_env env(nm, st); 423 env.output()->print_cr("Decoding compiled method " INTPTR_FORMAT ":", nm); 424 env.output()->print_cr("Code:"); 425 426 #ifdef SHARK 427 SharkEntry* entry = (SharkEntry *) nm->instructions_begin(); 428 unsigned char* p = entry->code_start(); 429 unsigned char* end = entry->code_limit(); 430 #else 431 unsigned char* p = nm->instructions_begin(); 432 unsigned char* end = nm->instructions_end(); 433 #endif // SHARK 434 435 // If there has been profiling, print the buckets. 436 if (FlatProfiler::bucket_start_for(p) != NULL) { 437 unsigned char* p1 = p; 438 int total_bucket_count = 0; 439 while (p1 < end) { 440 unsigned char* p0 = p1; 441 p1 += pd_instruction_alignment(); 442 address bucket_pc = FlatProfiler::bucket_start_for(p1); 443 if (bucket_pc != NULL && bucket_pc > p0 && bucket_pc <= p1) 444 total_bucket_count += FlatProfiler::bucket_count_for(p0); 445 } 446 env.set_total_ticks(total_bucket_count); 447 } 448 449 env.decode_instructions(p, end); 450 } |