< prev index next >

src/share/vm/opto/superword.cpp

Print this page




1671           if (def && in_bb(def)) {
1672             found = true;
1673             break;
1674           }
1675         }
1676         if (!found) {
1677           assert(n != entry, "can't be entry");
1678           _data_entry.push(n);
1679         }
1680       }
1681     }
1682   }
1683 
1684   // Find memory slices (head and tail)
1685   for (DUIterator_Fast imax, i = lp()->fast_outs(imax); i < imax; i++) {
1686     Node *n = lp()->fast_out(i);
1687     if (in_bb(n) && (n->is_Phi() && n->bottom_type() == Type::MEMORY)) {
1688       Node* n_tail  = n->in(LoopNode::LoopBackControl);
1689       if (n_tail != n->in(LoopNode::EntryControl)) {
1690         if (!n_tail->is_Mem()) {
1691           assert(n_tail->is_Mem(), err_msg_res("unexpected node for memory slice: %s", n_tail->Name()));
1692           return false; // Bailout
1693         }
1694         _mem_slice_head.push(n);
1695         _mem_slice_tail.push(n_tail);
1696       }
1697     }
1698   }
1699 
1700   // Create an RPO list of nodes in block
1701 
1702   visited_clear();
1703   post_visited_clear();
1704 
1705   // Push all non-control nodes with no inputs from within block, then control entry
1706   for (int j = 0; j < _data_entry.length(); j++) {
1707     Node* n = _data_entry.at(j);
1708     visited_set(n);
1709     _stk.push(n);
1710   }
1711   visited_set(entry);


2307 SWPointer::SWPointer(MemNode* mem, SuperWord* slp) :
2308   _mem(mem), _slp(slp),  _base(NULL),  _adr(NULL),
2309   _scale(0), _offset(0), _invar(NULL), _negate_invar(false) {
2310 
2311   Node* adr = mem->in(MemNode::Address);
2312   if (!adr->is_AddP()) {
2313     assert(!valid(), "too complex");
2314     return;
2315   }
2316   // Match AddP(base, AddP(ptr, k*iv [+ invariant]), constant)
2317   Node* base = adr->in(AddPNode::Base);
2318   // The base address should be loop invariant
2319   if (!invariant(base)) {
2320     assert(!valid(), "base address is loop variant");
2321     return;
2322   }
2323   //unsafe reference could not be aligned appropriately without runtime checking
2324   if (base == NULL || base->bottom_type() == Type::TOP) {
2325     assert(!valid(), "unsafe access");
2326     return;





















2327   }
2328   for (int i = 0; i < 3; i++) {
2329     if (!scaled_iv_plus_offset(adr->in(AddPNode::Offset))) {
2330       assert(!valid(), "too complex");
2331       return;
2332     }
2333     adr = adr->in(AddPNode::Address);
2334     if (base == adr || !adr->is_AddP()) {
2335       break; // stop looking at addp's
2336     }
2337   }
2338   _base = base;
2339   _adr  = adr;
2340   assert(valid(), "Usable");
2341 }
2342 
2343 // Following is used to create a temporary object during
2344 // the pattern match of an address expression.
2345 SWPointer::SWPointer(SWPointer* p) :
2346   _mem(p->_mem), _slp(p->_slp),  _base(NULL),  _adr(NULL),




1671           if (def && in_bb(def)) {
1672             found = true;
1673             break;
1674           }
1675         }
1676         if (!found) {
1677           assert(n != entry, "can't be entry");
1678           _data_entry.push(n);
1679         }
1680       }
1681     }
1682   }
1683 
1684   // Find memory slices (head and tail)
1685   for (DUIterator_Fast imax, i = lp()->fast_outs(imax); i < imax; i++) {
1686     Node *n = lp()->fast_out(i);
1687     if (in_bb(n) && (n->is_Phi() && n->bottom_type() == Type::MEMORY)) {
1688       Node* n_tail  = n->in(LoopNode::LoopBackControl);
1689       if (n_tail != n->in(LoopNode::EntryControl)) {
1690         if (!n_tail->is_Mem()) {
1691           assert(n_tail->is_Mem() || n_tail == n, err_msg_res("unexpected node for memory slice: %s", n_tail->Name()));
1692           return false; // Bailout
1693         }
1694         _mem_slice_head.push(n);
1695         _mem_slice_tail.push(n_tail);
1696       }
1697     }
1698   }
1699 
1700   // Create an RPO list of nodes in block
1701 
1702   visited_clear();
1703   post_visited_clear();
1704 
1705   // Push all non-control nodes with no inputs from within block, then control entry
1706   for (int j = 0; j < _data_entry.length(); j++) {
1707     Node* n = _data_entry.at(j);
1708     visited_set(n);
1709     _stk.push(n);
1710   }
1711   visited_set(entry);


2307 SWPointer::SWPointer(MemNode* mem, SuperWord* slp) :
2308   _mem(mem), _slp(slp),  _base(NULL),  _adr(NULL),
2309   _scale(0), _offset(0), _invar(NULL), _negate_invar(false) {
2310 
2311   Node* adr = mem->in(MemNode::Address);
2312   if (!adr->is_AddP()) {
2313     assert(!valid(), "too complex");
2314     return;
2315   }
2316   // Match AddP(base, AddP(ptr, k*iv [+ invariant]), constant)
2317   Node* base = adr->in(AddPNode::Base);
2318   // The base address should be loop invariant
2319   if (!invariant(base)) {
2320     assert(!valid(), "base address is loop variant");
2321     return;
2322   }
2323   //unsafe reference could not be aligned appropriately without runtime checking
2324   if (base == NULL || base->bottom_type() == Type::TOP) {
2325     assert(!valid(), "unsafe access");
2326     return;
2327   }
2328   if (UseShenandoahGC) {
2329     // Detect a Shenandoah write barrier between the pre and main loop
2330     // (which could break loop alignment code)
2331     CountedLoopNode *main_head = slp->lp()->as_CountedLoop();
2332     if (main_head->is_main_loop()) {
2333       Node* c = main_head->in(LoopNode::EntryControl)->in(0)->in(0)->in(0);
2334       if (!c->is_CountedLoopEnd()) {
2335         // in case of a reserve copy
2336         c = c->in(0)->in(0);
2337         assert(c->is_CountedLoopEnd(), "where's the pre loop?");
2338       }
2339       CountedLoopEndNode* pre_end = c->as_CountedLoopEnd();
2340       CountedLoopNode* pre_loop = pre_end->loopnode();
2341       assert(pre_loop->is_pre_loop(), "where's the pre loop?");
2342       
2343       Node* base_c = phase()->get_ctrl(base);
2344       if (!phase()->is_dominator(base_c, pre_loop)) {
2345         return;
2346       }
2347     }
2348   }
2349   for (int i = 0; i < 3; i++) {
2350     if (!scaled_iv_plus_offset(adr->in(AddPNode::Offset))) {
2351       assert(!valid(), "too complex");
2352       return;
2353     }
2354     adr = adr->in(AddPNode::Address);
2355     if (base == adr || !adr->is_AddP()) {
2356       break; // stop looking at addp's
2357     }
2358   }
2359   _base = base;
2360   _adr  = adr;
2361   assert(valid(), "Usable");
2362 }
2363 
2364 // Following is used to create a temporary object during
2365 // the pattern match of an address expression.
2366 SWPointer::SWPointer(SWPointer* p) :
2367   _mem(p->_mem), _slp(p->_slp),  _base(NULL),  _adr(NULL),


< prev index next >