3228 // from sliding up past the just-emitted store. 3229 3230 MemBarNode* mb = MemBarNode::make(C, opcode, alias_idx, precedent); 3231 mb->set_req(TypeFunc::Control,control()); 3232 if (alias_idx == Compile::AliasIdxBot) { 3233 mb->set_req(TypeFunc::Memory, merged_memory()->base_memory()); 3234 } else { 3235 assert(!(opcode == Op_Initialize && alias_idx != Compile::AliasIdxRaw), "fix caller"); 3236 mb->set_req(TypeFunc::Memory, memory(alias_idx)); 3237 } 3238 Node* membar = _gvn.transform(mb); 3239 set_control(_gvn.transform(new ProjNode(membar, TypeFunc::Control))); 3240 if (alias_idx == Compile::AliasIdxBot) { 3241 merged_memory()->set_base_memory(_gvn.transform(new ProjNode(membar, TypeFunc::Memory))); 3242 } else { 3243 set_memory(_gvn.transform(new ProjNode(membar, TypeFunc::Memory)),alias_idx); 3244 } 3245 return membar; 3246 } 3247 3248 //------------------------------shared_lock------------------------------------ 3249 // Emit locking code. 3250 FastLockNode* GraphKit::shared_lock(Node* obj) { 3251 // bci is either a monitorenter bc or InvocationEntryBci 3252 // %%% SynchronizationEntryBCI is redundant; use InvocationEntryBci in interfaces 3253 assert(SynchronizationEntryBCI == InvocationEntryBci, ""); 3254 3255 if( !GenerateSynchronizationCode ) 3256 return NULL; // Not locking things? 3257 if (stopped()) // Dead monitor? 3258 return NULL; 3259 3260 assert(dead_locals_are_killed(), "should kill locals before sync. point"); 3261 3262 obj = access_resolve(obj, ACCESS_READ | ACCESS_WRITE); 3263 3264 // Box the stack location 3265 Node* box = _gvn.transform(new BoxLockNode(next_monitor())); 3266 Node* mem = reset_memory(); 3267 | 3228 // from sliding up past the just-emitted store. 3229 3230 MemBarNode* mb = MemBarNode::make(C, opcode, alias_idx, precedent); 3231 mb->set_req(TypeFunc::Control,control()); 3232 if (alias_idx == Compile::AliasIdxBot) { 3233 mb->set_req(TypeFunc::Memory, merged_memory()->base_memory()); 3234 } else { 3235 assert(!(opcode == Op_Initialize && alias_idx != Compile::AliasIdxRaw), "fix caller"); 3236 mb->set_req(TypeFunc::Memory, memory(alias_idx)); 3237 } 3238 Node* membar = _gvn.transform(mb); 3239 set_control(_gvn.transform(new ProjNode(membar, TypeFunc::Control))); 3240 if (alias_idx == Compile::AliasIdxBot) { 3241 merged_memory()->set_base_memory(_gvn.transform(new ProjNode(membar, TypeFunc::Memory))); 3242 } else { 3243 set_memory(_gvn.transform(new ProjNode(membar, TypeFunc::Memory)),alias_idx); 3244 } 3245 return membar; 3246 } 3247 3248 void GraphKit::insert_store_load_for_barrier() { 3249 Node* mem = reset_memory(); 3250 MemBarNode* mb = MemBarNode::make(C, Op_MemBarVolatile, Compile::AliasIdxRaw); 3251 mb->init_req(TypeFunc::Control, control()); 3252 mb->init_req(TypeFunc::Memory, mem); 3253 Node* membar = _gvn.transform(mb); 3254 set_control(_gvn.transform(new ProjNode(membar, TypeFunc::Control))); 3255 Node* newmem = _gvn.transform(new ProjNode(membar, TypeFunc::Memory)); 3256 set_all_memory(mem); 3257 set_memory(newmem, Compile::AliasIdxRaw); 3258 } 3259 3260 //------------------------------shared_lock------------------------------------ 3261 // Emit locking code. 3262 FastLockNode* GraphKit::shared_lock(Node* obj) { 3263 // bci is either a monitorenter bc or InvocationEntryBci 3264 // %%% SynchronizationEntryBCI is redundant; use InvocationEntryBci in interfaces 3265 assert(SynchronizationEntryBCI == InvocationEntryBci, ""); 3266 3267 if( !GenerateSynchronizationCode ) 3268 return NULL; // Not locking things? 3269 if (stopped()) // Dead monitor? 3270 return NULL; 3271 3272 assert(dead_locals_are_killed(), "should kill locals before sync. point"); 3273 3274 obj = access_resolve(obj, ACCESS_READ | ACCESS_WRITE); 3275 3276 // Box the stack location 3277 Node* box = _gvn.transform(new BoxLockNode(next_monitor())); 3278 Node* mem = reset_memory(); 3279 |