< prev index next >

src/share/vm/opto/superword.cpp

Print this page




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


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





















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




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


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


< prev index next >