< 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);


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





















2319   }
2320   for (int i = 0; i < 3; i++) {
2321     if (!scaled_iv_plus_offset(adr->in(AddPNode::Offset))) {
2322       assert(!valid(), "too complex");
2323       return;
2324     }
2325     adr = adr->in(AddPNode::Address);
2326     if (base == adr || !adr->is_AddP()) {
2327       break; // stop looking at addp's
2328     }
2329   }
2330   _base = base;
2331   _adr  = adr;
2332   assert(valid(), "Usable");
2333 }
2334 
2335 // Following is used to create a temporary object during
2336 // the pattern match of an address expression.
2337 SWPointer::SWPointer(SWPointer* p) :
2338   _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);


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


< prev index next >