1064 allocation_index = i; |
1064 allocation_index = i; |
1065 load_index = 3 - allocation_index; |
1065 load_index = 3 - allocation_index; |
1066 break; |
1066 break; |
1067 } |
1067 } |
1068 } |
1068 } |
1069 LoadNode* load = NULL; |
1069 bool has_load = ( allocation != NULL && |
1070 if (allocation != NULL && base->in(load_index)->is_Load()) { |
1070 (base->in(load_index)->is_Load() || |
1071 load = base->in(load_index)->as_Load(); |
1071 base->in(load_index)->is_DecodeN() && |
1072 } |
1072 base->in(load_index)->in(1)->is_Load()) ); |
1073 if (load != NULL && in(Memory)->is_Phi() && in(Memory)->in(0) == base->in(0)) { |
1073 if (has_load && in(Memory)->is_Phi() && in(Memory)->in(0) == base->in(0)) { |
1074 // Push the loads from the phi that comes from valueOf up |
1074 // Push the loads from the phi that comes from valueOf up |
1075 // through it to allow elimination of the loads and the recovery |
1075 // through it to allow elimination of the loads and the recovery |
1076 // of the original value. |
1076 // of the original value. |
1077 Node* mem_phi = in(Memory); |
1077 Node* mem_phi = in(Memory); |
1078 Node* offset = in(Address)->in(AddPNode::Offset); |
1078 Node* offset = in(Address)->in(AddPNode::Offset); |
1104 PhiNode* result = PhiNode::make_blank(region, this); |
1104 PhiNode* result = PhiNode::make_blank(region, this); |
1105 result->set_req(allocation_index, in1); |
1105 result->set_req(allocation_index, in1); |
1106 result->set_req(load_index, in2); |
1106 result->set_req(load_index, in2); |
1107 return result; |
1107 return result; |
1108 } |
1108 } |
1109 } else if (base->is_Load()) { |
1109 } else if (base->is_Load() || |
|
1110 base->is_DecodeN() && base->in(1)->is_Load()) { |
|
1111 if (base->is_DecodeN()) { |
|
1112 // Get LoadN node which loads cached Integer object |
|
1113 base = base->in(1); |
|
1114 } |
1110 // Eliminate the load of Integer.value for integers from the cache |
1115 // Eliminate the load of Integer.value for integers from the cache |
1111 // array by deriving the value from the index into the array. |
1116 // array by deriving the value from the index into the array. |
1112 // Capture the offset of the load and then reverse the computation. |
1117 // Capture the offset of the load and then reverse the computation. |
1113 Node* load_base = base->in(Address)->in(AddPNode::Base); |
1118 Node* load_base = base->in(Address)->in(AddPNode::Base); |
|
1119 if (load_base->is_DecodeN()) { |
|
1120 // Get LoadN node which loads IntegerCache.cache field |
|
1121 load_base = load_base->in(1); |
|
1122 } |
1114 if (load_base != NULL) { |
1123 if (load_base != NULL) { |
1115 Compile::AliasType* atp = phase->C->alias_type(load_base->adr_type()); |
1124 Compile::AliasType* atp = phase->C->alias_type(load_base->adr_type()); |
1116 intptr_t cache_offset; |
1125 intptr_t cache_offset; |
1117 int shift = -1; |
1126 int shift = -1; |
1118 Node* cache = NULL; |
1127 Node* cache = NULL; |