src/share/vm/opto/compile.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 8022585 Sdiff src/share/vm/opto

src/share/vm/opto/compile.cpp

Print this page




 637                   _node_bundling_base(NULL),
 638                   _java_calls(0),
 639                   _inner_loops(0),
 640                   _scratch_const_size(-1),
 641                   _in_scratch_emit_size(false),
 642                   _dead_node_list(comp_arena()),
 643                   _dead_node_count(0),
 644 #ifndef PRODUCT
 645                   _trace_opto_output(TraceOptoOutput || method()->has_option("TraceOptoOutput")),
 646                   _printer(IdealGraphPrinter::printer()),
 647 #endif
 648                   _congraph(NULL),
 649                   _late_inlines(comp_arena(), 2, 0, NULL),
 650                   _string_late_inlines(comp_arena(), 2, 0, NULL),
 651                   _boxing_late_inlines(comp_arena(), 2, 0, NULL),
 652                   _late_inlines_pos(0),
 653                   _number_of_mh_late_inlines(0),
 654                   _inlining_progress(false),
 655                   _inlining_incrementally(false),
 656                   _print_inlining_list(NULL),
 657                   _print_inlining(0) {
 658   C = this;
 659 
 660   CompileWrapper cw(this);
 661 #ifndef PRODUCT
 662   if (TimeCompiler2) {
 663     tty->print(" ");
 664     target->holder()->name()->print();
 665     tty->print(".");
 666     target->print_short_name();
 667     tty->print("  ");
 668   }
 669   TraceTime t1("Total compilation time", &_t_totalCompilation, TimeCompiler, TimeCompiler2);
 670   TraceTime t2(NULL, &_t_methodCompilation, TimeCompiler, false);
 671   bool print_opto_assembly = PrintOptoAssembly || _method->has_option("PrintOptoAssembly");
 672   if (!print_opto_assembly) {
 673     bool print_assembly = (PrintAssembly || _method->should_print_assembly());
 674     if (print_assembly && !Disassembler::can_decode()) {
 675       tty->print_cr("PrintAssembly request changed to PrintOptoAssembly");
 676       print_opto_assembly = true;
 677     }
 678   }
 679   set_print_assembly(print_opto_assembly);
 680   set_parsed_irreducible_loop(false);
 681 #endif


 682 
 683   if (ProfileTraps) {
 684     // Make sure the method being compiled gets its own MDO,
 685     // so we can at least track the decompile_count().
 686     method()->ensure_method_data();
 687   }
 688 
 689   Init(::AliasLevel);
 690 
 691 
 692   print_compile_messages();
 693 
 694   if (UseOldInlining || PrintCompilation NOT_PRODUCT( || PrintOpto) )
 695     _ilt = InlineTree::build_inline_tree_root();
 696   else
 697     _ilt = NULL;
 698 
 699   // Even if NO memory addresses are used, MergeMem nodes must have at least 1 slice
 700   assert(num_alias_types() >= AliasIdxRaw, "");
 701 
 702 #define MINIMUM_NODE_HASH  1023
 703   // Node list that Iterative GVN will start with
 704   Unique_Node_List for_igvn(comp_arena());
 705   set_for_igvn(&for_igvn);
 706 
 707   // GVN that will be run immediately on new nodes
 708   uint estimated_size = method()->code_size()*4+64;
 709   estimated_size = (estimated_size < MINIMUM_NODE_HASH ? MINIMUM_NODE_HASH : estimated_size);
 710   PhaseGVN gvn(node_arena(), estimated_size);
 711   set_initial_gvn(&gvn);
 712 
 713   if (PrintInlining  || PrintIntrinsics NOT_PRODUCT( || PrintOptoInlining)) {
 714     _print_inlining_list = new (comp_arena())GrowableArray<PrintInliningBuffer>(comp_arena(), 1, 1, PrintInliningBuffer());
 715   }
 716   { // Scope for timing the parser
 717     TracePhase t3("parse", &_t_parser, true);
 718 
 719     // Put top into the hash table ASAP.
 720     initial_gvn()->transform_no_reclaim(top());
 721 
 722     // Set up tf(), start(), and find a CallGenerator.
 723     CallGenerator* cg = NULL;
 724     if (is_osr_compilation()) {
 725       const TypeTuple *domain = StartOSRNode::osr_domain();
 726       const TypeTuple *range = TypeTuple::make_range(method()->signature());
 727       init_tf(TypeFunc::make(domain, range));
 728       StartNode* s = new (this) StartOSRNode(root(), domain);
 729       initial_gvn()->set_type_bottom(s);
 730       init_start(s);
 731       cg = CallGenerator::for_osr(method(), entry_bci());
 732     } else {
 733       // Normal case.


 920     _eliminate_boxing(false),
 921     _failure_reason(NULL),
 922     _code_buffer("Compile::Fill_buffer"),
 923     _has_method_handle_invokes(false),
 924     _mach_constant_base_node(NULL),
 925     _node_bundling_limit(0),
 926     _node_bundling_base(NULL),
 927     _java_calls(0),
 928     _inner_loops(0),
 929 #ifndef PRODUCT
 930     _trace_opto_output(TraceOptoOutput),
 931     _printer(NULL),
 932 #endif
 933     _dead_node_list(comp_arena()),
 934     _dead_node_count(0),
 935     _congraph(NULL),
 936     _number_of_mh_late_inlines(0),
 937     _inlining_progress(false),
 938     _inlining_incrementally(false),
 939     _print_inlining_list(NULL),
 940     _print_inlining(0) {
 941   C = this;
 942 
 943 #ifndef PRODUCT
 944   TraceTime t1(NULL, &_t_totalCompilation, TimeCompiler, false);
 945   TraceTime t2(NULL, &_t_stubCompilation, TimeCompiler, false);
 946   set_print_assembly(PrintFrameConverterAssembly);
 947   set_parsed_irreducible_loop(false);
 948 #endif
 949   CompileWrapper cw(this);
 950   Init(/*AliasLevel=*/ 0);
 951   init_tf((*generator)());
 952 
 953   {
 954     // The following is a dummy for the sake of GraphKit::gen_stub
 955     Unique_Node_List for_igvn(comp_arena());
 956     set_for_igvn(&for_igvn);  // not used, but some GraphKit guys push on this
 957     PhaseGVN gvn(Thread::current()->resource_area(),255);
 958     set_initial_gvn(&gvn);    // not significant, but GraphKit guys use it pervasively
 959     gvn.transform_no_reclaim(top());
 960 


3594   assert(labels.is_nonempty(), "must be");
3595   assert((uint) labels.length() == n->outcnt(), err_msg_res("must be equal: %d == %d", labels.length(), n->outcnt()));
3596 
3597   // Since MachConstantNode::constant_offset() also contains
3598   // table_base_offset() we need to subtract the table_base_offset()
3599   // to get the plain offset into the constant table.
3600   int offset = n->constant_offset() - table_base_offset();
3601 
3602   MacroAssembler _masm(&cb);
3603   address* jump_table_base = (address*) (_masm.code()->consts()->start() + offset);
3604 
3605   for (uint i = 0; i < n->outcnt(); i++) {
3606     address* constant_addr = &jump_table_base[i];
3607     assert(*constant_addr == (((address) n) + i), err_msg_res("all jump-table entries must contain adjusted node pointer: " INTPTR_FORMAT " == " INTPTR_FORMAT, *constant_addr, (((address) n) + i)));
3608     *constant_addr = cb.consts()->target(*labels.at(i), (address) constant_addr);
3609     cb.consts()->relocate((address) constant_addr, relocInfo::internal_word_type);
3610   }
3611 }
3612 
3613 void Compile::dump_inlining() {
3614   if (PrintInlining || PrintIntrinsics NOT_PRODUCT( || PrintOptoInlining)) {
3615     // Print inlining message for candidates that we couldn't inline
3616     // for lack of space or non constant receiver
3617     for (int i = 0; i < _late_inlines.length(); i++) {
3618       CallGenerator* cg = _late_inlines.at(i);
3619       cg->print_inlining_late("live nodes > LiveNodeCountInliningCutoff");
3620     }
3621     Unique_Node_List useful;
3622     useful.push(root());
3623     for (uint next = 0; next < useful.size(); ++next) {
3624       Node* n  = useful.at(next);
3625       if (n->is_Call() && n->as_Call()->generator() != NULL && n->as_Call()->generator()->call_node() == n) {
3626         CallNode* call = n->as_Call();
3627         CallGenerator* cg = call->generator();
3628         cg->print_inlining_late("receiver not constant");
3629       }
3630       uint max = n->len();
3631       for ( uint i = 0; i < max; ++i ) {
3632         Node *m = n->in(i);
3633         if ( m == NULL ) continue;
3634         useful.push(m);
3635       }
3636     }
3637     for (int i = 0; i < _print_inlining_list->length(); i++) {
3638       tty->print(_print_inlining_list->at(i).ss()->as_string());
3639     }
3640   }
3641 }
3642 
3643 int Compile::cmp_expensive_nodes(Node* n1, Node* n2) {
3644   if (n1->Opcode() < n2->Opcode())      return -1;
3645   else if (n1->Opcode() > n2->Opcode()) return 1;
3646 
3647   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()));
3648   for (uint i = 1; i < n1->req(); i++) {
3649     if (n1->in(i) < n2->in(i))      return -1;
3650     else if (n1->in(i) > n2->in(i)) return 1;
3651   }
3652 
3653   return 0;
3654 }
3655 
3656 int Compile::cmp_expensive_nodes(Node** n1p, Node** n2p) {
3657   Node* n1 = *n1p;
3658   Node* n2 = *n2p;




 637                   _node_bundling_base(NULL),
 638                   _java_calls(0),
 639                   _inner_loops(0),
 640                   _scratch_const_size(-1),
 641                   _in_scratch_emit_size(false),
 642                   _dead_node_list(comp_arena()),
 643                   _dead_node_count(0),
 644 #ifndef PRODUCT
 645                   _trace_opto_output(TraceOptoOutput || method()->has_option("TraceOptoOutput")),
 646                   _printer(IdealGraphPrinter::printer()),
 647 #endif
 648                   _congraph(NULL),
 649                   _late_inlines(comp_arena(), 2, 0, NULL),
 650                   _string_late_inlines(comp_arena(), 2, 0, NULL),
 651                   _boxing_late_inlines(comp_arena(), 2, 0, NULL),
 652                   _late_inlines_pos(0),
 653                   _number_of_mh_late_inlines(0),
 654                   _inlining_progress(false),
 655                   _inlining_incrementally(false),
 656                   _print_inlining_list(NULL),
 657                   _print_inlining_idx(0) {
 658   C = this;
 659 
 660   CompileWrapper cw(this);
 661 #ifndef PRODUCT
 662   if (TimeCompiler2) {
 663     tty->print(" ");
 664     target->holder()->name()->print();
 665     tty->print(".");
 666     target->print_short_name();
 667     tty->print("  ");
 668   }
 669   TraceTime t1("Total compilation time", &_t_totalCompilation, TimeCompiler, TimeCompiler2);
 670   TraceTime t2(NULL, &_t_methodCompilation, TimeCompiler, false);
 671   bool print_opto_assembly = PrintOptoAssembly || _method->has_option("PrintOptoAssembly");
 672   if (!print_opto_assembly) {
 673     bool print_assembly = (PrintAssembly || _method->should_print_assembly());
 674     if (print_assembly && !Disassembler::can_decode()) {
 675       tty->print_cr("PrintAssembly request changed to PrintOptoAssembly");
 676       print_opto_assembly = true;
 677     }
 678   }
 679   set_print_assembly(print_opto_assembly);
 680   set_parsed_irreducible_loop(false);
 681 #endif
 682   set_print_inlining(PrintInlining || method()->has_option("PrintInlining") NOT_PRODUCT( || PrintOptoInlining));
 683   set_print_intrinsics(PrintIntrinsics || method()->has_option("PrintIntrinsics"));
 684 
 685   if (ProfileTraps) {
 686     // Make sure the method being compiled gets its own MDO,
 687     // so we can at least track the decompile_count().
 688     method()->ensure_method_data();
 689   }
 690 
 691   Init(::AliasLevel);
 692 
 693 
 694   print_compile_messages();
 695 
 696   if (UseOldInlining || PrintCompilation NOT_PRODUCT( || PrintOpto) )
 697     _ilt = InlineTree::build_inline_tree_root();
 698   else
 699     _ilt = NULL;
 700 
 701   // Even if NO memory addresses are used, MergeMem nodes must have at least 1 slice
 702   assert(num_alias_types() >= AliasIdxRaw, "");
 703 
 704 #define MINIMUM_NODE_HASH  1023
 705   // Node list that Iterative GVN will start with
 706   Unique_Node_List for_igvn(comp_arena());
 707   set_for_igvn(&for_igvn);
 708 
 709   // GVN that will be run immediately on new nodes
 710   uint estimated_size = method()->code_size()*4+64;
 711   estimated_size = (estimated_size < MINIMUM_NODE_HASH ? MINIMUM_NODE_HASH : estimated_size);
 712   PhaseGVN gvn(node_arena(), estimated_size);
 713   set_initial_gvn(&gvn);
 714 
 715   if (print_inlining() || print_intrinsics()) {
 716     _print_inlining_list = new (comp_arena())GrowableArray<PrintInliningBuffer>(comp_arena(), 1, 1, PrintInliningBuffer());
 717   }
 718   { // Scope for timing the parser
 719     TracePhase t3("parse", &_t_parser, true);
 720 
 721     // Put top into the hash table ASAP.
 722     initial_gvn()->transform_no_reclaim(top());
 723 
 724     // Set up tf(), start(), and find a CallGenerator.
 725     CallGenerator* cg = NULL;
 726     if (is_osr_compilation()) {
 727       const TypeTuple *domain = StartOSRNode::osr_domain();
 728       const TypeTuple *range = TypeTuple::make_range(method()->signature());
 729       init_tf(TypeFunc::make(domain, range));
 730       StartNode* s = new (this) StartOSRNode(root(), domain);
 731       initial_gvn()->set_type_bottom(s);
 732       init_start(s);
 733       cg = CallGenerator::for_osr(method(), entry_bci());
 734     } else {
 735       // Normal case.


 922     _eliminate_boxing(false),
 923     _failure_reason(NULL),
 924     _code_buffer("Compile::Fill_buffer"),
 925     _has_method_handle_invokes(false),
 926     _mach_constant_base_node(NULL),
 927     _node_bundling_limit(0),
 928     _node_bundling_base(NULL),
 929     _java_calls(0),
 930     _inner_loops(0),
 931 #ifndef PRODUCT
 932     _trace_opto_output(TraceOptoOutput),
 933     _printer(NULL),
 934 #endif
 935     _dead_node_list(comp_arena()),
 936     _dead_node_count(0),
 937     _congraph(NULL),
 938     _number_of_mh_late_inlines(0),
 939     _inlining_progress(false),
 940     _inlining_incrementally(false),
 941     _print_inlining_list(NULL),
 942     _print_inlining_idx(0) {
 943   C = this;
 944 
 945 #ifndef PRODUCT
 946   TraceTime t1(NULL, &_t_totalCompilation, TimeCompiler, false);
 947   TraceTime t2(NULL, &_t_stubCompilation, TimeCompiler, false);
 948   set_print_assembly(PrintFrameConverterAssembly);
 949   set_parsed_irreducible_loop(false);
 950 #endif
 951   CompileWrapper cw(this);
 952   Init(/*AliasLevel=*/ 0);
 953   init_tf((*generator)());
 954 
 955   {
 956     // The following is a dummy for the sake of GraphKit::gen_stub
 957     Unique_Node_List for_igvn(comp_arena());
 958     set_for_igvn(&for_igvn);  // not used, but some GraphKit guys push on this
 959     PhaseGVN gvn(Thread::current()->resource_area(),255);
 960     set_initial_gvn(&gvn);    // not significant, but GraphKit guys use it pervasively
 961     gvn.transform_no_reclaim(top());
 962 


3596   assert(labels.is_nonempty(), "must be");
3597   assert((uint) labels.length() == n->outcnt(), err_msg_res("must be equal: %d == %d", labels.length(), n->outcnt()));
3598 
3599   // Since MachConstantNode::constant_offset() also contains
3600   // table_base_offset() we need to subtract the table_base_offset()
3601   // to get the plain offset into the constant table.
3602   int offset = n->constant_offset() - table_base_offset();
3603 
3604   MacroAssembler _masm(&cb);
3605   address* jump_table_base = (address*) (_masm.code()->consts()->start() + offset);
3606 
3607   for (uint i = 0; i < n->outcnt(); i++) {
3608     address* constant_addr = &jump_table_base[i];
3609     assert(*constant_addr == (((address) n) + i), err_msg_res("all jump-table entries must contain adjusted node pointer: " INTPTR_FORMAT " == " INTPTR_FORMAT, *constant_addr, (((address) n) + i)));
3610     *constant_addr = cb.consts()->target(*labels.at(i), (address) constant_addr);
3611     cb.consts()->relocate((address) constant_addr, relocInfo::internal_word_type);
3612   }
3613 }
3614 
3615 void Compile::dump_inlining() {
3616   if (print_inlining() || print_intrinsics()) {
3617     // Print inlining message for candidates that we couldn't inline
3618     // for lack of space or non constant receiver
3619     for (int i = 0; i < _late_inlines.length(); i++) {
3620       CallGenerator* cg = _late_inlines.at(i);
3621       cg->print_inlining_late("live nodes > LiveNodeCountInliningCutoff");
3622     }
3623     Unique_Node_List useful;
3624     useful.push(root());
3625     for (uint next = 0; next < useful.size(); ++next) {
3626       Node* n  = useful.at(next);
3627       if (n->is_Call() && n->as_Call()->generator() != NULL && n->as_Call()->generator()->call_node() == n) {
3628         CallNode* call = n->as_Call();
3629         CallGenerator* cg = call->generator();
3630         cg->print_inlining_late("receiver not constant");
3631       }
3632       uint max = n->len();
3633       for ( uint i = 0; i < max; ++i ) {
3634         Node *m = n->in(i);
3635         if ( m == NULL ) continue;
3636         useful.push(m);
3637       }
3638     }
3639     for (int i = 0; i < _print_inlining_list->length(); i++) {
3640       tty->print(_print_inlining_list->adr_at(i)->ss()->as_string());
3641     }
3642   }
3643 }
3644 
3645 int Compile::cmp_expensive_nodes(Node* n1, Node* n2) {
3646   if (n1->Opcode() < n2->Opcode())      return -1;
3647   else if (n1->Opcode() > n2->Opcode()) return 1;
3648 
3649   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()));
3650   for (uint i = 1; i < n1->req(); i++) {
3651     if (n1->in(i) < n2->in(i))      return -1;
3652     else if (n1->in(i) > n2->in(i)) return 1;
3653   }
3654 
3655   return 0;
3656 }
3657 
3658 int Compile::cmp_expensive_nodes(Node** n1p, Node** n2p) {
3659   Node* n1 = *n1p;
3660   Node* n2 = *n2p;


src/share/vm/opto/compile.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File