comparison src/share/vm/opto/matcher.cpp @ 3849:f1c12354c3f7

7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths Summary: replace MemBarAcquire/MemBarRelease nodes on the monitor enter/exit code paths with new MemBarAcquireLock/MemBarReleaseLock nodes Reviewed-by: kvn, twisti
author roland
date Tue, 02 Aug 2011 18:36:40 +0200
parents 7d9e451f5416
children 1af104d6cf99
comparison
equal deleted inserted replaced
3848:a19c671188cb 3849:f1c12354c3f7
2228 i-=2; 2228 i-=2;
2229 } 2229 }
2230 } 2230 }
2231 } 2231 }
2232 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 2233 // 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 2234 // atomic instruction acting as a store_load barrier without any
2286 // intervening volatile load, and thus we don't need a barrier here. 2235 // intervening volatile load, and thus we don't need a barrier here.
2287 // We retain the Node to act as a compiler ordering barrier. 2236 // We retain the Node to act as a compiler ordering barrier.
2288 bool Matcher::post_store_load_barrier(const Node *vmb) { 2237 bool Matcher::post_store_load_barrier(const Node *vmb) {