Mercurial > hg > graal-compiler
comparison src/share/vm/opto/graphKit.cpp @ 372:be41fa651400
Merge
author | rasbold |
---|---|
date | Tue, 30 Sep 2008 15:53:55 -0700 |
parents | 5f44674206d3 194b8e3a2fc4 |
children | 82a980778b92 1b9fc6e3171b |
comparison
equal
deleted
inserted
replaced
365:5f44674206d3 | 372:be41fa651400 |
---|---|
585 _sp = kit->sp(); | 585 _sp = kit->sp(); |
586 kit->set_map(clone_map ? kit->clone_map() : NULL); | 586 kit->set_map(clone_map ? kit->clone_map() : NULL); |
587 #ifdef ASSERT | 587 #ifdef ASSERT |
588 _bci = kit->bci(); | 588 _bci = kit->bci(); |
589 Parse* parser = kit->is_Parse(); | 589 Parse* parser = kit->is_Parse(); |
590 int block = (parser == NULL || parser->block() == NULL) ? -1 : parser->block()->pre_order(); | 590 int block = (parser == NULL || parser->block() == NULL) ? -1 : parser->block()->rpo(); |
591 _block = block; | 591 _block = block; |
592 #endif | 592 #endif |
593 } | 593 } |
594 PreserveJVMState::~PreserveJVMState() { | 594 PreserveJVMState::~PreserveJVMState() { |
595 GraphKit* kit = _kit; | 595 GraphKit* kit = _kit; |
596 #ifdef ASSERT | 596 #ifdef ASSERT |
597 assert(kit->bci() == _bci, "bci must not shift"); | 597 assert(kit->bci() == _bci, "bci must not shift"); |
598 Parse* parser = kit->is_Parse(); | 598 Parse* parser = kit->is_Parse(); |
599 int block = (parser == NULL || parser->block() == NULL) ? -1 : parser->block()->pre_order(); | 599 int block = (parser == NULL || parser->block() == NULL) ? -1 : parser->block()->rpo(); |
600 assert(block == _block, "block must not shift"); | 600 assert(block == _block, "block must not shift"); |
601 #endif | 601 #endif |
602 kit->set_map(_map); | 602 kit->set_map(_map); |
603 kit->set_sp(_sp); | 603 kit->set_sp(_sp); |
604 } | 604 } |
1047 } | 1047 } |
1048 | 1048 |
1049 //-------------------------load_array_length----------------------------------- | 1049 //-------------------------load_array_length----------------------------------- |
1050 Node* GraphKit::load_array_length(Node* array) { | 1050 Node* GraphKit::load_array_length(Node* array) { |
1051 // Special-case a fresh allocation to avoid building nodes: | 1051 // Special-case a fresh allocation to avoid building nodes: |
1052 Node* alen = AllocateArrayNode::Ideal_length(array, &_gvn); | 1052 AllocateArrayNode* alloc = AllocateArrayNode::Ideal_array_allocation(array, &_gvn); |
1053 if (alen != NULL) return alen; | 1053 Node *alen; |
1054 Node *r_adr = basic_plus_adr(array, arrayOopDesc::length_offset_in_bytes()); | 1054 if (alloc == NULL) { |
1055 return _gvn.transform( new (C, 3) LoadRangeNode(0, immutable_memory(), r_adr, TypeInt::POS)); | 1055 Node *r_adr = basic_plus_adr(array, arrayOopDesc::length_offset_in_bytes()); |
1056 alen = _gvn.transform( new (C, 3) LoadRangeNode(0, immutable_memory(), r_adr, TypeInt::POS)); | |
1057 } else { | |
1058 alen = alloc->Ideal_length(); | |
1059 Node* ccast = alloc->make_ideal_length(_gvn.type(array)->is_aryptr(), &_gvn); | |
1060 if (ccast != alen) { | |
1061 alen = _gvn.transform(ccast); | |
1062 } | |
1063 } | |
1064 return alen; | |
1056 } | 1065 } |
1057 | 1066 |
1058 //------------------------------do_null_check---------------------------------- | 1067 //------------------------------do_null_check---------------------------------- |
1059 // Helper function to do a NULL pointer check. Returned value is | 1068 // Helper function to do a NULL pointer check. Returned value is |
1060 // the incoming address with NULL casted away. You are allowed to use the | 1069 // the incoming address with NULL casted away. You are allowed to use the |
2845 javaoop = _gvn.transform(javaoop); | 2854 javaoop = _gvn.transform(javaoop); |
2846 C->set_recent_alloc(control(), javaoop); | 2855 C->set_recent_alloc(control(), javaoop); |
2847 assert(just_allocated_object(control()) == javaoop, "just allocated"); | 2856 assert(just_allocated_object(control()) == javaoop, "just allocated"); |
2848 | 2857 |
2849 #ifdef ASSERT | 2858 #ifdef ASSERT |
2850 { // Verify that the AllocateNode::Ideal_foo recognizers work: | 2859 { // Verify that the AllocateNode::Ideal_allocation recognizers work: |
2851 Node* kn = alloc->in(AllocateNode::KlassNode); | 2860 assert(AllocateNode::Ideal_allocation(rawoop, &_gvn) == alloc, |
2852 Node* ln = alloc->in(AllocateNode::ALength); | 2861 "Ideal_allocation works"); |
2853 assert(AllocateNode::Ideal_klass(rawoop, &_gvn) == kn, | 2862 assert(AllocateNode::Ideal_allocation(javaoop, &_gvn) == alloc, |
2854 "Ideal_klass works"); | 2863 "Ideal_allocation works"); |
2855 assert(AllocateNode::Ideal_klass(javaoop, &_gvn) == kn, | |
2856 "Ideal_klass works"); | |
2857 if (alloc->is_AllocateArray()) { | 2864 if (alloc->is_AllocateArray()) { |
2858 assert(AllocateArrayNode::Ideal_length(rawoop, &_gvn) == ln, | 2865 assert(AllocateArrayNode::Ideal_array_allocation(rawoop, &_gvn) == alloc->as_AllocateArray(), |
2859 "Ideal_length works"); | 2866 "Ideal_allocation works"); |
2860 assert(AllocateArrayNode::Ideal_length(javaoop, &_gvn) == ln, | 2867 assert(AllocateArrayNode::Ideal_array_allocation(javaoop, &_gvn) == alloc->as_AllocateArray(), |
2861 "Ideal_length works"); | 2868 "Ideal_allocation works"); |
2862 } else { | 2869 } else { |
2863 assert(ln->is_top(), "no length, please"); | 2870 assert(alloc->in(AllocateNode::ALength)->is_top(), "no length, please"); |
2864 } | 2871 } |
2865 } | 2872 } |
2866 #endif //ASSERT | 2873 #endif //ASSERT |
2867 | 2874 |
2868 return javaoop; | 2875 return javaoop; |
3107 // Cast to correct type. Note that the klass_node may be constant or not, | 3114 // Cast to correct type. Note that the klass_node may be constant or not, |
3108 // and in the latter case the actual array type will be inexact also. | 3115 // and in the latter case the actual array type will be inexact also. |
3109 // (This happens via a non-constant argument to inline_native_newArray.) | 3116 // (This happens via a non-constant argument to inline_native_newArray.) |
3110 // In any case, the value of klass_node provides the desired array type. | 3117 // In any case, the value of klass_node provides the desired array type. |
3111 const TypeInt* length_type = _gvn.find_int_type(length); | 3118 const TypeInt* length_type = _gvn.find_int_type(length); |
3112 const TypeInt* narrow_length_type = NULL; | |
3113 const TypeOopPtr* ary_type = _gvn.type(klass_node)->is_klassptr()->as_instance_type(); | 3119 const TypeOopPtr* ary_type = _gvn.type(klass_node)->is_klassptr()->as_instance_type(); |
3114 if (ary_type->isa_aryptr() && length_type != NULL) { | 3120 if (ary_type->isa_aryptr() && length_type != NULL) { |
3115 // Try to get a better type than POS for the size | 3121 // Try to get a better type than POS for the size |
3116 ary_type = ary_type->is_aryptr()->cast_to_size(length_type); | 3122 ary_type = ary_type->is_aryptr()->cast_to_size(length_type); |
3117 narrow_length_type = ary_type->is_aryptr()->size(); | |
3118 if (narrow_length_type == length_type) | |
3119 narrow_length_type = NULL; | |
3120 } | 3123 } |
3121 | 3124 |
3122 Node* javaoop = set_output_for_allocation(alloc, ary_type, raw_mem_only); | 3125 Node* javaoop = set_output_for_allocation(alloc, ary_type, raw_mem_only); |
3123 | 3126 |
3124 // Cast length on remaining path to be positive: | 3127 // Cast length on remaining path to be as narrow as possible |
3125 if (narrow_length_type != NULL) { | 3128 if (map()->find_edge(length) >= 0) { |
3126 Node* ccast = new (C, 2) CastIINode(length, narrow_length_type); | 3129 Node* ccast = alloc->make_ideal_length(ary_type, &_gvn); |
3127 ccast->set_req(0, control()); | 3130 if (ccast != length) { |
3128 _gvn.set_type_bottom(ccast); | 3131 _gvn.set_type_bottom(ccast); |
3129 record_for_igvn(ccast); | 3132 record_for_igvn(ccast); |
3130 if (map()->find_edge(length) >= 0) { | |
3131 replace_in_map(length, ccast); | 3133 replace_in_map(length, ccast); |
3132 } | 3134 } |
3133 } | 3135 } |
3134 | 3136 |
3135 return javaoop; | 3137 return javaoop; |