2142 } else if (pk->at(0)->is_Load()) { //load |
2142 } else if (pk->at(0)->is_Load()) { //load |
2143 // all loads in the pack should have the same memory state. By default, |
2143 // all loads in the pack should have the same memory state. By default, |
2144 // we use the memory state of the last load. However, if any load could |
2144 // we use the memory state of the last load. However, if any load could |
2145 // not be moved down due to the dependence constraint, we use the memory |
2145 // not be moved down due to the dependence constraint, we use the memory |
2146 // state of the first load. |
2146 // state of the first load. |
2147 Node* last_mem = executed_last(pk)->in(MemNode::Memory); |
2147 Node* first_mem = pk->at(0)->in(MemNode::Memory); |
2148 Node* first_mem = executed_first(pk)->in(MemNode::Memory); |
2148 Node* last_mem = first_mem; |
|
2149 for (uint i = 1; i < pk->size(); i++) { |
|
2150 Node* ld = pk->at(i); |
|
2151 Node* mem = ld->in(MemNode::Memory); |
|
2152 assert(in_bb(first_mem) || in_bb(mem) || mem == first_mem, "2 different memory state from outside the loop?"); |
|
2153 if (in_bb(mem)) { |
|
2154 if (in_bb(first_mem) && bb_idx(mem) < bb_idx(first_mem)) { |
|
2155 first_mem = mem; |
|
2156 } |
|
2157 if (!in_bb(last_mem) || bb_idx(mem) > bb_idx(last_mem)) { |
|
2158 last_mem = mem; |
|
2159 } |
|
2160 } |
|
2161 } |
2149 bool schedule_last = true; |
2162 bool schedule_last = true; |
2150 for (uint i = 0; i < pk->size(); i++) { |
2163 for (uint i = 0; i < pk->size(); i++) { |
2151 Node* ld = pk->at(i); |
2164 Node* ld = pk->at(i); |
2152 for (Node* current = last_mem; current != ld->in(MemNode::Memory); |
2165 for (Node* current = last_mem; current != ld->in(MemNode::Memory); |
2153 current=current->in(MemNode::Memory)) { |
2166 current=current->in(MemNode::Memory)) { |