711 tty->print(" "); |
711 tty->print(" "); |
712 } |
712 } |
713 TraceTime t1("Total compilation time", &_t_totalCompilation, CITime, CITimeVerbose); |
713 TraceTime t1("Total compilation time", &_t_totalCompilation, CITime, CITimeVerbose); |
714 TraceTime t2(NULL, &_t_methodCompilation, CITime, false); |
714 TraceTime t2(NULL, &_t_methodCompilation, CITime, false); |
715 |
715 |
|
716 #if defined(SUPPORT_ASSEMBLY) || defined(SUPPORT_ABSTRACT_ASSEMBLY) |
|
717 bool print_opto_assembly = directive->PrintOptoAssemblyOption; |
|
718 // We can always print a disassembly, either abstract (hex dump) or |
|
719 // with the help of a suitable hsdis library. Thus, we should not |
|
720 // couple print_assembly and print_opto_assembly controls. |
|
721 // But: always print opto and regular assembly on compile command 'print'. |
|
722 bool print_assembly = directive->PrintAssemblyOption; |
|
723 set_print_assembly(print_opto_assembly || print_assembly); |
|
724 #else |
|
725 set_print_assembly(false); // must initialize. |
|
726 #endif |
|
727 |
716 #ifndef PRODUCT |
728 #ifndef PRODUCT |
717 bool print_opto_assembly = directive->PrintOptoAssemblyOption; |
|
718 if (!print_opto_assembly) { |
|
719 bool print_assembly = directive->PrintAssemblyOption; |
|
720 if (print_assembly && !Disassembler::can_decode()) { |
|
721 tty->print_cr("PrintAssembly request changed to PrintOptoAssembly"); |
|
722 print_opto_assembly = true; |
|
723 } |
|
724 } |
|
725 set_print_assembly(print_opto_assembly); |
|
726 set_parsed_irreducible_loop(false); |
729 set_parsed_irreducible_loop(false); |
727 |
730 |
728 if (directive->ReplayInlineOption) { |
731 if (directive->ReplayInlineOption) { |
729 _replay_inline_data = ciReplay::load_inline_data(method(), entry_bci(), ci_env->comp_level()); |
732 _replay_inline_data = ciReplay::load_inline_data(method(), entry_bci(), ci_env->comp_level()); |
730 } |
733 } |
2550 } |
2555 } |
2551 |
2556 |
2552 |
2557 |
2553 //------------------------------dump_asm--------------------------------------- |
2558 //------------------------------dump_asm--------------------------------------- |
2554 // Dump formatted assembly |
2559 // Dump formatted assembly |
2555 #ifndef PRODUCT |
2560 #if defined(SUPPORT_OPTO_ASSEMBLY) |
2556 void Compile::dump_asm(int *pcs, uint pc_limit) { |
2561 void Compile::dump_asm_on(outputStream* st, int* pcs, uint pc_limit) { |
|
2562 |
|
2563 int pc_digits = 3; // #chars required for pc |
|
2564 int sb_chars = 3; // #chars for "start bundle" indicator |
|
2565 int tab_size = 8; |
|
2566 if (pcs != NULL) { |
|
2567 int max_pc = 0; |
|
2568 for (uint i = 0; i < pc_limit; i++) { |
|
2569 max_pc = (max_pc < pcs[i]) ? pcs[i] : max_pc; |
|
2570 } |
|
2571 pc_digits = ((max_pc < 4096) ? 3 : ((max_pc < 65536) ? 4 : ((max_pc < 65536*256) ? 6 : 8))); // #chars required for pc |
|
2572 } |
|
2573 int prefix_len = ((pc_digits + sb_chars + tab_size - 1)/tab_size)*tab_size; |
|
2574 |
2557 bool cut_short = false; |
2575 bool cut_short = false; |
2558 tty->print_cr("#"); |
2576 st->print_cr("#"); |
2559 tty->print("# "); _tf->dump(); tty->cr(); |
2577 st->print("# "); _tf->dump_on(st); st->cr(); |
2560 tty->print_cr("#"); |
2578 st->print_cr("#"); |
2561 |
2579 |
2562 // For all blocks |
2580 // For all blocks |
2563 int pc = 0x0; // Program counter |
2581 int pc = 0x0; // Program counter |
2564 char starts_bundle = ' '; |
2582 char starts_bundle = ' '; |
2565 _regalloc->dump_frame(); |
2583 _regalloc->dump_frame(); |
2573 Block* block = _cfg->get_block(i); |
2591 Block* block = _cfg->get_block(i); |
2574 if (block->is_connector() && !Verbose) { |
2592 if (block->is_connector() && !Verbose) { |
2575 continue; |
2593 continue; |
2576 } |
2594 } |
2577 n = block->head(); |
2595 n = block->head(); |
2578 if (pcs && n->_idx < pc_limit) { |
2596 if ((pcs != NULL) && (n->_idx < pc_limit)) { |
2579 tty->print("%3.3x ", pcs[n->_idx]); |
2597 pc = pcs[n->_idx]; |
2580 } else { |
2598 st->print("%*.*x", pc_digits, pc_digits, pc); |
2581 tty->print(" "); |
2599 } |
2582 } |
2600 st->fill_to(prefix_len); |
2583 block->dump_head(_cfg); |
2601 block->dump_head(_cfg, st); |
2584 if (block->is_connector()) { |
2602 if (block->is_connector()) { |
2585 tty->print_cr(" # Empty connector block"); |
2603 st->fill_to(prefix_len); |
|
2604 st->print_cr("# Empty connector block"); |
2586 } else if (block->num_preds() == 2 && block->pred(1)->is_CatchProj() && block->pred(1)->as_CatchProj()->_con == CatchProjNode::fall_through_index) { |
2605 } else if (block->num_preds() == 2 && block->pred(1)->is_CatchProj() && block->pred(1)->as_CatchProj()->_con == CatchProjNode::fall_through_index) { |
2587 tty->print_cr(" # Block is sole successor of call"); |
2606 st->fill_to(prefix_len); |
|
2607 st->print_cr("# Block is sole successor of call"); |
2588 } |
2608 } |
2589 |
2609 |
2590 // For all instructions |
2610 // For all instructions |
2591 Node *delay = NULL; |
2611 Node *delay = NULL; |
2592 for (uint j = 0; j < block->number_of_nodes(); j++) { |
2612 for (uint j = 0; j < block->number_of_nodes(); j++) { |
2618 !n->is_Catch() && // Would be nice to print exception table targets |
2638 !n->is_Catch() && // Would be nice to print exception table targets |
2619 !n->is_MergeMem() && // Not very interesting |
2639 !n->is_MergeMem() && // Not very interesting |
2620 !n->is_top() && // Debug info table constants |
2640 !n->is_top() && // Debug info table constants |
2621 !(n->is_Con() && !n->is_Mach())// Debug info table constants |
2641 !(n->is_Con() && !n->is_Mach())// Debug info table constants |
2622 ) { |
2642 ) { |
2623 if (pcs && n->_idx < pc_limit) |
2643 if ((pcs != NULL) && (n->_idx < pc_limit)) { |
2624 tty->print("%3.3x", pcs[n->_idx]); |
2644 pc = pcs[n->_idx]; |
2625 else |
2645 st->print("%*.*x", pc_digits, pc_digits, pc); |
2626 tty->print(" "); |
2646 } else { |
2627 tty->print(" %c ", starts_bundle); |
2647 st->fill_to(pc_digits); |
|
2648 } |
|
2649 st->print(" %c ", starts_bundle); |
2628 starts_bundle = ' '; |
2650 starts_bundle = ' '; |
2629 tty->print("\t"); |
2651 st->fill_to(prefix_len); |
2630 n->format(_regalloc, tty); |
2652 n->format(_regalloc, st); |
2631 tty->cr(); |
2653 st->cr(); |
2632 } |
2654 } |
2633 |
2655 |
2634 // If we have an instruction with a delay slot, and have seen a delay, |
2656 // If we have an instruction with a delay slot, and have seen a delay, |
2635 // then back up and print it |
2657 // then back up and print it |
2636 if (valid_bundle_info(n) && node_bundling(n)->use_unconditional_delay()) { |
2658 if (valid_bundle_info(n) && node_bundling(n)->use_unconditional_delay()) { |
2637 assert(delay != NULL, "no unconditional delay instruction"); |
2659 // Coverity finding - Explicit null dereferenced. |
|
2660 guarantee(delay != NULL, "no unconditional delay instruction"); |
2638 if (WizardMode) delay->dump(); |
2661 if (WizardMode) delay->dump(); |
2639 |
2662 |
2640 if (node_bundling(delay)->starts_bundle()) |
2663 if (node_bundling(delay)->starts_bundle()) |
2641 starts_bundle = '+'; |
2664 starts_bundle = '+'; |
2642 if (pcs && n->_idx < pc_limit) |
2665 if ((pcs != NULL) && (n->_idx < pc_limit)) { |
2643 tty->print("%3.3x", pcs[n->_idx]); |
2666 pc = pcs[n->_idx]; |
2644 else |
2667 st->print("%*.*x", pc_digits, pc_digits, pc); |
2645 tty->print(" "); |
2668 } else { |
2646 tty->print(" %c ", starts_bundle); |
2669 st->fill_to(pc_digits); |
|
2670 } |
|
2671 st->print(" %c ", starts_bundle); |
2647 starts_bundle = ' '; |
2672 starts_bundle = ' '; |
2648 tty->print("\t"); |
2673 st->fill_to(prefix_len); |
2649 delay->format(_regalloc, tty); |
2674 delay->format(_regalloc, st); |
2650 tty->cr(); |
2675 st->cr(); |
2651 delay = NULL; |
2676 delay = NULL; |
2652 } |
2677 } |
2653 |
2678 |
2654 // Dump the exception table as well |
2679 // Dump the exception table as well |
2655 if( n->is_Catch() && (Verbose || WizardMode) ) { |
2680 if( n->is_Catch() && (Verbose || WizardMode) ) { |
2656 // Print the exception table for this offset |
2681 // Print the exception table for this offset |
2657 _handler_table.print_subtable_for(pc); |
2682 _handler_table.print_subtable_for(pc); |
2658 } |
2683 } |
2659 } |
2684 st->bol(); // Make sure we start on a new line |
2660 |
2685 } |
2661 if (pcs && n->_idx < pc_limit) |
2686 st->cr(); // one empty line between blocks |
2662 tty->print_cr("%3.3x", pcs[n->_idx]); |
|
2663 else |
|
2664 tty->cr(); |
|
2665 |
|
2666 assert(cut_short || delay == NULL, "no unconditional delay branch"); |
2687 assert(cut_short || delay == NULL, "no unconditional delay branch"); |
2667 |
|
2668 } // End of per-block dump |
2688 } // End of per-block dump |
2669 tty->cr(); |
2689 |
2670 |
2690 if (cut_short) st->print_cr("*** disassembly is cut short ***"); |
2671 if (cut_short) tty->print_cr("*** disassembly is cut short ***"); |
|
2672 } |
2691 } |
2673 #endif |
2692 #endif |
2674 |
2693 |
2675 //------------------------------Final_Reshape_Counts--------------------------- |
2694 //------------------------------Final_Reshape_Counts--------------------------- |
2676 // This class defines counters to help identify when a method |
2695 // This class defines counters to help identify when a method |