2245 }
2246
2247 // Make slow path call
2248 CallNode *call = make_slow_call( (CallNode *) lock, OptoRuntime::complete_monitor_enter_Type(), OptoRuntime::complete_monitor_locking_Java(), NULL, slow_path, obj, box );
2249
2250 extract_call_projections(call);
2251
2252 // Slow path can only throw asynchronous exceptions, which are always
2253 // de-opted. So the compiler thinks the slow-call can never throw an
2254 // exception. If it DOES throw an exception we would need the debug
2255 // info removed first (since if it throws there is no monitor).
2256 assert ( _ioproj_fallthrough == NULL && _ioproj_catchall == NULL &&
2257 _memproj_catchall == NULL && _catchallcatchproj == NULL, "Unexpected projection from Lock");
2258
2259 // Capture slow path
2260 // disconnect fall-through projection from call and create a new one
2261 // hook up users of fall-through projection to region
2262 Node *slow_ctrl = _fallthroughproj->clone();
2263 transform_later(slow_ctrl);
2264 _igvn.hash_delete(_fallthroughproj);
2265 _fallthroughproj->disconnect_inputs(NULL);
2266 region->init_req(1, slow_ctrl);
2267 // region inputs are now complete
2268 transform_later(region);
2269 _igvn.replace_node(_fallthroughproj, region);
2270
2271 Node *memproj = transform_later( new(C) ProjNode(call, TypeFunc::Memory) );
2272 mem_phi->init_req(1, memproj );
2273 transform_later(mem_phi);
2274 _igvn.replace_node(_memproj_fallthrough, mem_phi);
2275 }
2276
2277 //------------------------------expand_unlock_node----------------------
2278 void PhaseMacroExpand::expand_unlock_node(UnlockNode *unlock) {
2279
2280 Node* ctrl = unlock->in(TypeFunc::Control);
2281 Node* mem = unlock->in(TypeFunc::Memory);
2282 Node* obj = unlock->obj_node();
2283 Node* box = unlock->box_node();
2284
2285 assert(!box->as_BoxLock()->is_eliminated(), "sanity");
2310
2311 FastUnlockNode *funlock = new (C) FastUnlockNode( ctrl, obj, box );
2312 funlock = transform_later( funlock )->as_FastUnlock();
2313 // Optimize test; set region slot 2
2314 Node *slow_path = opt_bits_test(ctrl, region, 2, funlock, 0, 0);
2315
2316 CallNode *call = make_slow_call( (CallNode *) unlock, OptoRuntime::complete_monitor_exit_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_unlocking_C), "complete_monitor_unlocking_C", slow_path, obj, box );
2317
2318 extract_call_projections(call);
2319
2320 assert ( _ioproj_fallthrough == NULL && _ioproj_catchall == NULL &&
2321 _memproj_catchall == NULL && _catchallcatchproj == NULL, "Unexpected projection from Lock");
2322
2323 // No exceptions for unlocking
2324 // Capture slow path
2325 // disconnect fall-through projection from call and create a new one
2326 // hook up users of fall-through projection to region
2327 Node *slow_ctrl = _fallthroughproj->clone();
2328 transform_later(slow_ctrl);
2329 _igvn.hash_delete(_fallthroughproj);
2330 _fallthroughproj->disconnect_inputs(NULL);
2331 region->init_req(1, slow_ctrl);
2332 // region inputs are now complete
2333 transform_later(region);
2334 _igvn.replace_node(_fallthroughproj, region);
2335
2336 Node *memproj = transform_later( new(C) ProjNode(call, TypeFunc::Memory) );
2337 mem_phi->init_req(1, memproj );
2338 mem_phi->init_req(2, mem);
2339 transform_later(mem_phi);
2340 _igvn.replace_node(_memproj_fallthrough, mem_phi);
2341 }
2342
2343 //---------------------------eliminate_macro_nodes----------------------
2344 // Eliminate scalar replaced allocations and associated locks.
2345 void PhaseMacroExpand::eliminate_macro_nodes() {
2346 if (C->macro_count() == 0)
2347 return;
2348
2349 // First, attempt to eliminate locks
2350 int cnt = C->macro_count();
|
2245 }
2246
2247 // Make slow path call
2248 CallNode *call = make_slow_call( (CallNode *) lock, OptoRuntime::complete_monitor_enter_Type(), OptoRuntime::complete_monitor_locking_Java(), NULL, slow_path, obj, box );
2249
2250 extract_call_projections(call);
2251
2252 // Slow path can only throw asynchronous exceptions, which are always
2253 // de-opted. So the compiler thinks the slow-call can never throw an
2254 // exception. If it DOES throw an exception we would need the debug
2255 // info removed first (since if it throws there is no monitor).
2256 assert ( _ioproj_fallthrough == NULL && _ioproj_catchall == NULL &&
2257 _memproj_catchall == NULL && _catchallcatchproj == NULL, "Unexpected projection from Lock");
2258
2259 // Capture slow path
2260 // disconnect fall-through projection from call and create a new one
2261 // hook up users of fall-through projection to region
2262 Node *slow_ctrl = _fallthroughproj->clone();
2263 transform_later(slow_ctrl);
2264 _igvn.hash_delete(_fallthroughproj);
2265 _fallthroughproj->disconnect_inputs(NULL, C);
2266 region->init_req(1, slow_ctrl);
2267 // region inputs are now complete
2268 transform_later(region);
2269 _igvn.replace_node(_fallthroughproj, region);
2270
2271 Node *memproj = transform_later( new(C) ProjNode(call, TypeFunc::Memory) );
2272 mem_phi->init_req(1, memproj );
2273 transform_later(mem_phi);
2274 _igvn.replace_node(_memproj_fallthrough, mem_phi);
2275 }
2276
2277 //------------------------------expand_unlock_node----------------------
2278 void PhaseMacroExpand::expand_unlock_node(UnlockNode *unlock) {
2279
2280 Node* ctrl = unlock->in(TypeFunc::Control);
2281 Node* mem = unlock->in(TypeFunc::Memory);
2282 Node* obj = unlock->obj_node();
2283 Node* box = unlock->box_node();
2284
2285 assert(!box->as_BoxLock()->is_eliminated(), "sanity");
2310
2311 FastUnlockNode *funlock = new (C) FastUnlockNode( ctrl, obj, box );
2312 funlock = transform_later( funlock )->as_FastUnlock();
2313 // Optimize test; set region slot 2
2314 Node *slow_path = opt_bits_test(ctrl, region, 2, funlock, 0, 0);
2315
2316 CallNode *call = make_slow_call( (CallNode *) unlock, OptoRuntime::complete_monitor_exit_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_unlocking_C), "complete_monitor_unlocking_C", slow_path, obj, box );
2317
2318 extract_call_projections(call);
2319
2320 assert ( _ioproj_fallthrough == NULL && _ioproj_catchall == NULL &&
2321 _memproj_catchall == NULL && _catchallcatchproj == NULL, "Unexpected projection from Lock");
2322
2323 // No exceptions for unlocking
2324 // Capture slow path
2325 // disconnect fall-through projection from call and create a new one
2326 // hook up users of fall-through projection to region
2327 Node *slow_ctrl = _fallthroughproj->clone();
2328 transform_later(slow_ctrl);
2329 _igvn.hash_delete(_fallthroughproj);
2330 _fallthroughproj->disconnect_inputs(NULL, C);
2331 region->init_req(1, slow_ctrl);
2332 // region inputs are now complete
2333 transform_later(region);
2334 _igvn.replace_node(_fallthroughproj, region);
2335
2336 Node *memproj = transform_later( new(C) ProjNode(call, TypeFunc::Memory) );
2337 mem_phi->init_req(1, memproj );
2338 mem_phi->init_req(2, mem);
2339 transform_later(mem_phi);
2340 _igvn.replace_node(_memproj_fallthrough, mem_phi);
2341 }
2342
2343 //---------------------------eliminate_macro_nodes----------------------
2344 // Eliminate scalar replaced allocations and associated locks.
2345 void PhaseMacroExpand::eliminate_macro_nodes() {
2346 if (C->macro_count() == 0)
2347 return;
2348
2349 // First, attempt to eliminate locks
2350 int cnt = C->macro_count();
|