Mercurial > hg > truffle
comparison src/share/vm/opto/compile.cpp @ 17474:6fa574bfd32a
Merge
author | chegar |
---|---|
date | Thu, 03 Oct 2013 19:13:12 +0100 |
parents | 1b64d46620a3 |
children | 4a2acfb16e97 |
comparison
equal
deleted
inserted
replaced
17473:9b4ce069642e | 17474:6fa574bfd32a |
---|---|
652 _late_inlines_pos(0), | 652 _late_inlines_pos(0), |
653 _number_of_mh_late_inlines(0), | 653 _number_of_mh_late_inlines(0), |
654 _inlining_progress(false), | 654 _inlining_progress(false), |
655 _inlining_incrementally(false), | 655 _inlining_incrementally(false), |
656 _print_inlining_list(NULL), | 656 _print_inlining_list(NULL), |
657 _print_inlining(0) { | 657 _print_inlining_idx(0) { |
658 C = this; | 658 C = this; |
659 | 659 |
660 CompileWrapper cw(this); | 660 CompileWrapper cw(this); |
661 #ifndef PRODUCT | 661 #ifndef PRODUCT |
662 if (TimeCompiler2) { | 662 if (TimeCompiler2) { |
677 } | 677 } |
678 } | 678 } |
679 set_print_assembly(print_opto_assembly); | 679 set_print_assembly(print_opto_assembly); |
680 set_parsed_irreducible_loop(false); | 680 set_parsed_irreducible_loop(false); |
681 #endif | 681 #endif |
682 set_print_inlining(PrintInlining || method()->has_option("PrintInlining") NOT_PRODUCT( || PrintOptoInlining)); | |
683 set_print_intrinsics(PrintIntrinsics || method()->has_option("PrintIntrinsics")); | |
682 | 684 |
683 if (ProfileTraps) { | 685 if (ProfileTraps) { |
684 // Make sure the method being compiled gets its own MDO, | 686 // Make sure the method being compiled gets its own MDO, |
685 // so we can at least track the decompile_count(). | 687 // so we can at least track the decompile_count(). |
686 method()->ensure_method_data(); | 688 method()->ensure_method_data(); |
708 uint estimated_size = method()->code_size()*4+64; | 710 uint estimated_size = method()->code_size()*4+64; |
709 estimated_size = (estimated_size < MINIMUM_NODE_HASH ? MINIMUM_NODE_HASH : estimated_size); | 711 estimated_size = (estimated_size < MINIMUM_NODE_HASH ? MINIMUM_NODE_HASH : estimated_size); |
710 PhaseGVN gvn(node_arena(), estimated_size); | 712 PhaseGVN gvn(node_arena(), estimated_size); |
711 set_initial_gvn(&gvn); | 713 set_initial_gvn(&gvn); |
712 | 714 |
713 if (PrintInlining || PrintIntrinsics NOT_PRODUCT( || PrintOptoInlining)) { | 715 if (print_inlining() || print_intrinsics()) { |
714 _print_inlining_list = new (comp_arena())GrowableArray<PrintInliningBuffer>(comp_arena(), 1, 1, PrintInliningBuffer()); | 716 _print_inlining_list = new (comp_arena())GrowableArray<PrintInliningBuffer>(comp_arena(), 1, 1, PrintInliningBuffer()); |
715 } | 717 } |
716 { // Scope for timing the parser | 718 { // Scope for timing the parser |
717 TracePhase t3("parse", &_t_parser, true); | 719 TracePhase t3("parse", &_t_parser, true); |
718 | 720 |
935 _congraph(NULL), | 937 _congraph(NULL), |
936 _number_of_mh_late_inlines(0), | 938 _number_of_mh_late_inlines(0), |
937 _inlining_progress(false), | 939 _inlining_progress(false), |
938 _inlining_incrementally(false), | 940 _inlining_incrementally(false), |
939 _print_inlining_list(NULL), | 941 _print_inlining_list(NULL), |
940 _print_inlining(0) { | 942 _print_inlining_idx(0) { |
941 C = this; | 943 C = this; |
942 | 944 |
943 #ifndef PRODUCT | 945 #ifndef PRODUCT |
944 TraceTime t1(NULL, &_t_totalCompilation, TimeCompiler, false); | 946 TraceTime t1(NULL, &_t_totalCompilation, TimeCompiler, false); |
945 TraceTime t2(NULL, &_t_stubCompilation, TimeCompiler, false); | 947 TraceTime t2(NULL, &_t_stubCompilation, TimeCompiler, false); |
1295 offset = tj->offset(); | 1297 offset = tj->offset(); |
1296 } | 1298 } |
1297 | 1299 |
1298 // Array pointers need some flattening | 1300 // Array pointers need some flattening |
1299 const TypeAryPtr *ta = tj->isa_aryptr(); | 1301 const TypeAryPtr *ta = tj->isa_aryptr(); |
1302 if (ta && ta->is_stable()) { | |
1303 // Erase stability property for alias analysis. | |
1304 tj = ta = ta->cast_to_stable(false); | |
1305 } | |
1300 if( ta && is_known_inst ) { | 1306 if( ta && is_known_inst ) { |
1301 if ( offset != Type::OffsetBot && | 1307 if ( offset != Type::OffsetBot && |
1302 offset > arrayOopDesc::length_offset_in_bytes() ) { | 1308 offset > arrayOopDesc::length_offset_in_bytes() ) { |
1303 offset = Type::OffsetBot; // Flatten constant access into array body only | 1309 offset = Type::OffsetBot; // Flatten constant access into array body only |
1304 tj = ta = TypeAryPtr::make(ptr, ta->ary(), ta->klass(), true, offset, ta->instance_id()); | 1310 tj = ta = TypeAryPtr::make(ptr, ta->ary(), ta->klass(), true, offset, ta->instance_id()); |
1495 | 1501 |
1496 void Compile::AliasType::Init(int i, const TypePtr* at) { | 1502 void Compile::AliasType::Init(int i, const TypePtr* at) { |
1497 _index = i; | 1503 _index = i; |
1498 _adr_type = at; | 1504 _adr_type = at; |
1499 _field = NULL; | 1505 _field = NULL; |
1506 _element = NULL; | |
1500 _is_rewritable = true; // default | 1507 _is_rewritable = true; // default |
1501 const TypeOopPtr *atoop = (at != NULL) ? at->isa_oopptr() : NULL; | 1508 const TypeOopPtr *atoop = (at != NULL) ? at->isa_oopptr() : NULL; |
1502 if (atoop != NULL && atoop->is_known_instance()) { | 1509 if (atoop != NULL && atoop->is_known_instance()) { |
1503 const TypeOopPtr *gt = atoop->cast_to_instance_id(TypeOopPtr::InstanceBot); | 1510 const TypeOopPtr *gt = atoop->cast_to_instance_id(TypeOopPtr::InstanceBot); |
1504 _general_index = Compile::current()->get_alias_index(gt); | 1511 _general_index = Compile::current()->get_alias_index(gt); |
1613 if (flat->isa_instptr()) { | 1620 if (flat->isa_instptr()) { |
1614 if (flat->offset() == java_lang_Class::klass_offset_in_bytes() | 1621 if (flat->offset() == java_lang_Class::klass_offset_in_bytes() |
1615 && flat->is_instptr()->klass() == env()->Class_klass()) | 1622 && flat->is_instptr()->klass() == env()->Class_klass()) |
1616 alias_type(idx)->set_rewritable(false); | 1623 alias_type(idx)->set_rewritable(false); |
1617 } | 1624 } |
1625 if (flat->isa_aryptr()) { | |
1626 #ifdef ASSERT | |
1627 const int header_size_min = arrayOopDesc::base_offset_in_bytes(T_BYTE); | |
1628 // (T_BYTE has the weakest alignment and size restrictions...) | |
1629 assert(flat->offset() < header_size_min, "array body reference must be OffsetBot"); | |
1630 #endif | |
1631 if (flat->offset() == TypePtr::OffsetBot) { | |
1632 alias_type(idx)->set_element(flat->is_aryptr()->elem()); | |
1633 } | |
1634 } | |
1618 if (flat->isa_klassptr()) { | 1635 if (flat->isa_klassptr()) { |
1619 if (flat->offset() == in_bytes(Klass::super_check_offset_offset())) | 1636 if (flat->offset() == in_bytes(Klass::super_check_offset_offset())) |
1620 alias_type(idx)->set_rewritable(false); | 1637 alias_type(idx)->set_rewritable(false); |
1621 if (flat->offset() == in_bytes(Klass::modifier_flags_offset())) | 1638 if (flat->offset() == in_bytes(Klass::modifier_flags_offset())) |
1622 alias_type(idx)->set_rewritable(false); | 1639 alias_type(idx)->set_rewritable(false); |
1675 if (field->is_static()) | 1692 if (field->is_static()) |
1676 t = TypeInstPtr::make(field->holder()->java_mirror()); | 1693 t = TypeInstPtr::make(field->holder()->java_mirror()); |
1677 else | 1694 else |
1678 t = TypeOopPtr::make_from_klass_raw(field->holder()); | 1695 t = TypeOopPtr::make_from_klass_raw(field->holder()); |
1679 AliasType* atp = alias_type(t->add_offset(field->offset_in_bytes()), field); | 1696 AliasType* atp = alias_type(t->add_offset(field->offset_in_bytes()), field); |
1680 assert(field->is_final() == !atp->is_rewritable(), "must get the rewritable bits correct"); | 1697 assert((field->is_final() || field->is_stable()) == !atp->is_rewritable(), "must get the rewritable bits correct"); |
1681 return atp; | 1698 return atp; |
1682 } | 1699 } |
1683 | 1700 |
1684 | 1701 |
1685 //------------------------------have_alias_type-------------------------------- | 1702 //------------------------------have_alias_type-------------------------------- |
2629 assert( !addp->is_AddP() || | 2646 assert( !addp->is_AddP() || |
2630 addp->in(AddPNode::Base)->is_top() || // Top OK for allocation | 2647 addp->in(AddPNode::Base)->is_top() || // Top OK for allocation |
2631 addp->in(AddPNode::Base) == n->in(AddPNode::Base), | 2648 addp->in(AddPNode::Base) == n->in(AddPNode::Base), |
2632 "Base pointers must match" ); | 2649 "Base pointers must match" ); |
2633 #ifdef _LP64 | 2650 #ifdef _LP64 |
2634 if ((UseCompressedOops || UseCompressedKlassPointers) && | 2651 if ((UseCompressedOops || UseCompressedClassPointers) && |
2635 addp->Opcode() == Op_ConP && | 2652 addp->Opcode() == Op_ConP && |
2636 addp == n->in(AddPNode::Base) && | 2653 addp == n->in(AddPNode::Base) && |
2637 n->in(AddPNode::Offset)->is_Con()) { | 2654 n->in(AddPNode::Offset)->is_Con()) { |
2638 // Use addressing with narrow klass to load with offset on x86. | 2655 // Use addressing with narrow klass to load with offset on x86. |
2639 // On sparc loading 32-bits constant and decoding it have less | 2656 // On sparc loading 32-bits constant and decoding it have less |
3016 } | 3033 } |
3017 } | 3034 } |
3018 | 3035 |
3019 // Skip next transformation if compressed oops are not used. | 3036 // Skip next transformation if compressed oops are not used. |
3020 if ((UseCompressedOops && !Matcher::gen_narrow_oop_implicit_null_checks()) || | 3037 if ((UseCompressedOops && !Matcher::gen_narrow_oop_implicit_null_checks()) || |
3021 (!UseCompressedOops && !UseCompressedKlassPointers)) | 3038 (!UseCompressedOops && !UseCompressedClassPointers)) |
3022 return; | 3039 return; |
3023 | 3040 |
3024 // Go over safepoints nodes to skip DecodeN/DecodeNKlass nodes for debug edges. | 3041 // Go over safepoints nodes to skip DecodeN/DecodeNKlass nodes for debug edges. |
3025 // It could be done for an uncommon traps or any safepoints/calls | 3042 // It could be done for an uncommon traps or any safepoints/calls |
3026 // if the DecodeN/DecodeNKlass node is referenced only in a debug info. | 3043 // if the DecodeN/DecodeNKlass node is referenced only in a debug info. |
3594 cb.consts()->relocate((address) constant_addr, relocInfo::internal_word_type); | 3611 cb.consts()->relocate((address) constant_addr, relocInfo::internal_word_type); |
3595 } | 3612 } |
3596 } | 3613 } |
3597 | 3614 |
3598 void Compile::dump_inlining() { | 3615 void Compile::dump_inlining() { |
3599 if (PrintInlining || PrintIntrinsics NOT_PRODUCT( || PrintOptoInlining)) { | 3616 if (print_inlining() || print_intrinsics()) { |
3600 // Print inlining message for candidates that we couldn't inline | 3617 // Print inlining message for candidates that we couldn't inline |
3601 // for lack of space or non constant receiver | 3618 // for lack of space or non constant receiver |
3602 for (int i = 0; i < _late_inlines.length(); i++) { | 3619 for (int i = 0; i < _late_inlines.length(); i++) { |
3603 CallGenerator* cg = _late_inlines.at(i); | 3620 CallGenerator* cg = _late_inlines.at(i); |
3604 cg->print_inlining_late("live nodes > LiveNodeCountInliningCutoff"); | 3621 cg->print_inlining_late("live nodes > LiveNodeCountInliningCutoff"); |
3618 if ( m == NULL ) continue; | 3635 if ( m == NULL ) continue; |
3619 useful.push(m); | 3636 useful.push(m); |
3620 } | 3637 } |
3621 } | 3638 } |
3622 for (int i = 0; i < _print_inlining_list->length(); i++) { | 3639 for (int i = 0; i < _print_inlining_list->length(); i++) { |
3623 tty->print(_print_inlining_list->at(i).ss()->as_string()); | 3640 tty->print(_print_inlining_list->adr_at(i)->ss()->as_string()); |
3624 } | 3641 } |
3625 } | 3642 } |
3626 } | 3643 } |
3627 | 3644 |
3628 int Compile::cmp_expensive_nodes(Node* n1, Node* n2) { | 3645 int Compile::cmp_expensive_nodes(Node* n1, Node* n2) { |