src/share/vm/opto/matcher.cpp

Print this page
rev 2570 : imported patch membar2


2213         // Note: new_val may have a control edge if
2214         // the original ideal node DecodeN was matched before
2215         // it was unpinned in Matcher::collect_null_checks().
2216         // Unpin the mach node and mark it.
2217         new_val->set_req(0, NULL);
2218         new_val = (Node*)(((intptr_t)new_val) | 1);
2219       }
2220       // Is a match-tree root, so replace with the matched value
2221       _null_check_tests.map(i+1, new_val);
2222     } else {
2223       // Yank from candidate list
2224       _null_check_tests.map(i+1,_null_check_tests[--cnt]);
2225       _null_check_tests.map(i,_null_check_tests[--cnt]);
2226       _null_check_tests.pop();
2227       _null_check_tests.pop();
2228       i-=2;
2229     }
2230   }
2231 }
2232 
2233 
2234 // Used by the DFA in dfa_sparc.cpp.  Check for a prior FastLock
2235 // acting as an Acquire and thus we don't need an Acquire here.  We
2236 // retain the Node to act as a compiler ordering barrier.
2237 bool Matcher::prior_fast_lock( const Node *acq ) {
2238   Node *r = acq->in(0);
2239   if( !r->is_Region() || r->req() <= 1 ) return false;
2240   Node *proj = r->in(1);
2241   if( !proj->is_Proj() ) return false;
2242   Node *call = proj->in(0);
2243   if( !call->is_Call() || call->as_Call()->entry_point() != OptoRuntime::complete_monitor_locking_Java() )
2244     return false;
2245 
2246   return true;
2247 }
2248 
2249 // Used by the DFA in dfa_sparc.cpp.  Check for a following FastUnLock
2250 // acting as a Release and thus we don't need a Release here.  We
2251 // retain the Node to act as a compiler ordering barrier.
2252 bool Matcher::post_fast_unlock( const Node *rel ) {
2253   Compile *C = Compile::current();
2254   assert( rel->Opcode() == Op_MemBarRelease, "" );
2255   const MemBarReleaseNode *mem = (const MemBarReleaseNode*)rel;
2256   DUIterator_Fast imax, i = mem->fast_outs(imax);
2257   Node *ctrl = NULL;
2258   while( true ) {
2259     ctrl = mem->fast_out(i);            // Throw out-of-bounds if proj not found
2260     assert( ctrl->is_Proj(), "only projections here" );
2261     ProjNode *proj = (ProjNode*)ctrl;
2262     if( proj->_con == TypeFunc::Control &&
2263         !C->node_arena()->contains(ctrl) ) // Unmatched old-space only
2264       break;
2265     i++;
2266   }
2267   Node *iff = NULL;
2268   for( DUIterator_Fast jmax, j = ctrl->fast_outs(jmax); j < jmax; j++ ) {
2269     Node *x = ctrl->fast_out(j);
2270     if( x->is_If() && x->req() > 1 &&
2271         !C->node_arena()->contains(x) ) { // Unmatched old-space only
2272       iff = x;
2273       break;
2274     }
2275   }
2276   if( !iff ) return false;
2277   Node *bol = iff->in(1);
2278   // The iff might be some random subclass of If or bol might be Con-Top
2279   if (!bol->is_Bool())  return false;
2280   assert( bol->req() > 1, "" );
2281   return (bol->in(1)->Opcode() == Op_FastUnlock);
2282 }
2283 
2284 // Used by the DFA in dfa_xxx.cpp.  Check for a following barrier or
2285 // atomic instruction acting as a store_load barrier without any
2286 // intervening volatile load, and thus we don't need a barrier here.
2287 // We retain the Node to act as a compiler ordering barrier.
2288 bool Matcher::post_store_load_barrier(const Node *vmb) {
2289   Compile *C = Compile::current();
2290   assert( vmb->is_MemBar(), "" );
2291   assert( vmb->Opcode() != Op_MemBarAcquire, "" );
2292   const MemBarNode *mem = (const MemBarNode*)vmb;
2293 
2294   // Get the Proj node, ctrl, that can be used to iterate forward
2295   Node *ctrl = NULL;
2296   DUIterator_Fast imax, i = mem->fast_outs(imax);
2297   while( true ) {
2298     ctrl = mem->fast_out(i);            // Throw out-of-bounds if proj not found
2299     assert( ctrl->is_Proj(), "only projections here" );
2300     ProjNode *proj = (ProjNode*)ctrl;
2301     if( proj->_con == TypeFunc::Control &&
2302         !C->node_arena()->contains(ctrl) ) // Unmatched old-space only
2303       break;




2213         // Note: new_val may have a control edge if
2214         // the original ideal node DecodeN was matched before
2215         // it was unpinned in Matcher::collect_null_checks().
2216         // Unpin the mach node and mark it.
2217         new_val->set_req(0, NULL);
2218         new_val = (Node*)(((intptr_t)new_val) | 1);
2219       }
2220       // Is a match-tree root, so replace with the matched value
2221       _null_check_tests.map(i+1, new_val);
2222     } else {
2223       // Yank from candidate list
2224       _null_check_tests.map(i+1,_null_check_tests[--cnt]);
2225       _null_check_tests.map(i,_null_check_tests[--cnt]);
2226       _null_check_tests.pop();
2227       _null_check_tests.pop();
2228       i-=2;
2229     }
2230   }
2231 }
2232 



















































2233 // Used by the DFA in dfa_xxx.cpp.  Check for a following barrier or
2234 // atomic instruction acting as a store_load barrier without any
2235 // intervening volatile load, and thus we don't need a barrier here.
2236 // We retain the Node to act as a compiler ordering barrier.
2237 bool Matcher::post_store_load_barrier(const Node *vmb) {
2238   Compile *C = Compile::current();
2239   assert( vmb->is_MemBar(), "" );
2240   assert( vmb->Opcode() != Op_MemBarAcquire, "" );
2241   const MemBarNode *mem = (const MemBarNode*)vmb;
2242 
2243   // Get the Proj node, ctrl, that can be used to iterate forward
2244   Node *ctrl = NULL;
2245   DUIterator_Fast imax, i = mem->fast_outs(imax);
2246   while( true ) {
2247     ctrl = mem->fast_out(i);            // Throw out-of-bounds if proj not found
2248     assert( ctrl->is_Proj(), "only projections here" );
2249     ProjNode *proj = (ProjNode*)ctrl;
2250     if( proj->_con == TypeFunc::Control &&
2251         !C->node_arena()->contains(ctrl) ) // Unmatched old-space only
2252       break;