comparison src/share/vm/opto/compile.cpp @ 17622:849eb7bfceac

8028468: Add inlining information into ciReplay Summary: Allow dump and replay inlining for specified method during a program execution. Reviewed-by: roland, twisti
author kvn
date Wed, 08 Jan 2014 10:25:50 -0800
parents 613e6a6fc328
children 5ec7dace41a6 abec000618bf
comparison
equal deleted inserted replaced
17621:df8573b1a44c 17622:849eb7bfceac
23 */ 23 */
24 24
25 #include "precompiled.hpp" 25 #include "precompiled.hpp"
26 #include "asm/macroAssembler.hpp" 26 #include "asm/macroAssembler.hpp"
27 #include "asm/macroAssembler.inline.hpp" 27 #include "asm/macroAssembler.inline.hpp"
28 #include "ci/ciReplay.hpp"
28 #include "classfile/systemDictionary.hpp" 29 #include "classfile/systemDictionary.hpp"
29 #include "code/exceptionHandlerTable.hpp" 30 #include "code/exceptionHandlerTable.hpp"
30 #include "code/nmethod.hpp" 31 #include "code/nmethod.hpp"
31 #include "compiler/compileLog.hpp" 32 #include "compiler/compileLog.hpp"
32 #include "compiler/disassembler.hpp" 33 #include "compiler/disassembler.hpp"
645 #ifndef PRODUCT 646 #ifndef PRODUCT
646 _trace_opto_output(TraceOptoOutput || method()->has_option("TraceOptoOutput")), 647 _trace_opto_output(TraceOptoOutput || method()->has_option("TraceOptoOutput")),
647 _printer(IdealGraphPrinter::printer()), 648 _printer(IdealGraphPrinter::printer()),
648 #endif 649 #endif
649 _congraph(NULL), 650 _congraph(NULL),
651 _replay_inline_data(NULL),
650 _late_inlines(comp_arena(), 2, 0, NULL), 652 _late_inlines(comp_arena(), 2, 0, NULL),
651 _string_late_inlines(comp_arena(), 2, 0, NULL), 653 _string_late_inlines(comp_arena(), 2, 0, NULL),
652 _boxing_late_inlines(comp_arena(), 2, 0, NULL), 654 _boxing_late_inlines(comp_arena(), 2, 0, NULL),
653 _late_inlines_pos(0), 655 _late_inlines_pos(0),
654 _number_of_mh_late_inlines(0), 656 _number_of_mh_late_inlines(0),
678 print_opto_assembly = true; 680 print_opto_assembly = true;
679 } 681 }
680 } 682 }
681 set_print_assembly(print_opto_assembly); 683 set_print_assembly(print_opto_assembly);
682 set_parsed_irreducible_loop(false); 684 set_parsed_irreducible_loop(false);
685
686 if (method()->has_option("ReplayInline")) {
687 _replay_inline_data = ciReplay::load_inline_data(method(), entry_bci(), ci_env->comp_level());
688 }
683 #endif 689 #endif
684 set_print_inlining(PrintInlining || method()->has_option("PrintInlining") NOT_PRODUCT( || PrintOptoInlining)); 690 set_print_inlining(PrintInlining || method()->has_option("PrintInlining") NOT_PRODUCT( || PrintOptoInlining));
685 set_print_intrinsics(PrintIntrinsics || method()->has_option("PrintIntrinsics")); 691 set_print_intrinsics(PrintIntrinsics || method()->has_option("PrintIntrinsics"));
686 692
687 if (ProfileTraps) { 693 if (ProfileTraps) {
847 } 853 }
848 } 854 }
849 #endif 855 #endif
850 856
851 NOT_PRODUCT( verify_barriers(); ) 857 NOT_PRODUCT( verify_barriers(); )
858
859 // Dump compilation data to replay it.
860 if (method()->has_option("DumpReplay")) {
861 env()->dump_replay_data(_compile_id);
862 }
863 if (method()->has_option("DumpInline") && (ilt() != NULL)) {
864 env()->dump_inline_data(_compile_id);
865 }
866
852 // Now that we know the size of all the monitors we can add a fixed slot 867 // Now that we know the size of all the monitors we can add a fixed slot
853 // for the original deopt pc. 868 // for the original deopt pc.
854 869
855 _orig_pc_slot = fixed_slots(); 870 _orig_pc_slot = fixed_slots();
856 int next_slot = _orig_pc_slot + (sizeof(address) / VMRegImpl::stack_slot_size); 871 int next_slot = _orig_pc_slot + (sizeof(address) / VMRegImpl::stack_slot_size);
936 _printer(NULL), 951 _printer(NULL),
937 #endif 952 #endif
938 _dead_node_list(comp_arena()), 953 _dead_node_list(comp_arena()),
939 _dead_node_count(0), 954 _dead_node_count(0),
940 _congraph(NULL), 955 _congraph(NULL),
956 _replay_inline_data(NULL),
941 _number_of_mh_late_inlines(0), 957 _number_of_mh_late_inlines(0),
942 _inlining_progress(false), 958 _inlining_progress(false),
943 _inlining_incrementally(false), 959 _inlining_incrementally(false),
944 _print_inlining_list(NULL), 960 _print_inlining_list(NULL),
945 _print_inlining_idx(0), 961 _print_inlining_idx(0),
3755 tty->print(_print_inlining_list->adr_at(i)->ss()->as_string()); 3771 tty->print(_print_inlining_list->adr_at(i)->ss()->as_string());
3756 } 3772 }
3757 } 3773 }
3758 } 3774 }
3759 3775
3776 // Dump inlining replay data to the stream.
3777 // Don't change thread state and acquire any locks.
3778 void Compile::dump_inline_data(outputStream* out) {
3779 InlineTree* inl_tree = ilt();
3780 if (inl_tree != NULL) {
3781 out->print(" inline %d", inl_tree->count());
3782 inl_tree->dump_replay_data(out);
3783 }
3784 }
3785
3760 int Compile::cmp_expensive_nodes(Node* n1, Node* n2) { 3786 int Compile::cmp_expensive_nodes(Node* n1, Node* n2) {
3761 if (n1->Opcode() < n2->Opcode()) return -1; 3787 if (n1->Opcode() < n2->Opcode()) return -1;
3762 else if (n1->Opcode() > n2->Opcode()) return 1; 3788 else if (n1->Opcode() > n2->Opcode()) return 1;
3763 3789
3764 assert(n1->req() == n2->req(), err_msg_res("can't compare %s nodes: n1->req() = %d, n2->req() = %d", NodeClassNames[n1->Opcode()], n1->req(), n2->req())); 3790 assert(n1->req() == n2->req(), err_msg_res("can't compare %s nodes: n1->req() = %d, n2->req() = %d", NodeClassNames[n1->Opcode()], n1->req(), n2->req()));