2401 // region->in(2) is set to fast path - the object is locked to the current thread. 2402 2403 slow_path->init_req(2, ctrl); // Capture slow-control 2404 slow_mem->init_req(2, fast_lock_mem_phi); 2405 2406 transform_later(slow_path); 2407 transform_later(slow_mem); 2408 // Reset lock's memory edge. 2409 lock->set_req(TypeFunc::Memory, slow_mem); 2410 2411 } else { 2412 region = new RegionNode(3); 2413 // create a Phi for the memory state 2414 mem_phi = new PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); 2415 2416 // Optimize test; set region slot 2 2417 slow_path = opt_bits_test(ctrl, region, 2, flock, 0, 0); 2418 mem_phi->init_req(2, mem); 2419 } 2420 2421 // Make slow path call 2422 CallNode *call = make_slow_call((CallNode *) lock, OptoRuntime::complete_monitor_enter_Type(), 2423 OptoRuntime::complete_monitor_locking_Java(), NULL, slow_path, 2424 obj, box, NULL); 2425 2426 extract_call_projections(call); 2427 2428 // Slow path can only throw asynchronous exceptions, which are always 2429 // de-opted. So the compiler thinks the slow-call can never throw an 2430 // exception. If it DOES throw an exception we would need the debug 2431 // info removed first (since if it throws there is no monitor). 2432 assert ( _ioproj_fallthrough == NULL && _ioproj_catchall == NULL && 2433 _memproj_catchall == NULL && _catchallcatchproj == NULL, "Unexpected projection from Lock"); 2434 2435 // Capture slow path 2436 // disconnect fall-through projection from call and create a new one 2437 // hook up users of fall-through projection to region 2438 Node *slow_ctrl = _fallthroughproj->clone(); 2439 transform_later(slow_ctrl); 2440 _igvn.hash_delete(_fallthroughproj); | 2401 // region->in(2) is set to fast path - the object is locked to the current thread. 2402 2403 slow_path->init_req(2, ctrl); // Capture slow-control 2404 slow_mem->init_req(2, fast_lock_mem_phi); 2405 2406 transform_later(slow_path); 2407 transform_later(slow_mem); 2408 // Reset lock's memory edge. 2409 lock->set_req(TypeFunc::Memory, slow_mem); 2410 2411 } else { 2412 region = new RegionNode(3); 2413 // create a Phi for the memory state 2414 mem_phi = new PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); 2415 2416 // Optimize test; set region slot 2 2417 slow_path = opt_bits_test(ctrl, region, 2, flock, 0, 0); 2418 mem_phi->init_req(2, mem); 2419 } 2420 2421 const TypeOopPtr* objptr = _igvn.type(obj)->make_oopptr(); 2422 if (objptr->can_be_value_type()) { 2423 // Deoptimize and re-execute if a value 2424 assert(EnableValhalla, "should only be used if value types are enabled"); 2425 Node* mark = make_load(slow_path, mem, obj, oopDesc::mark_offset_in_bytes(), TypeX_X, TypeX_X->basic_type()); 2426 Node* value_mask = _igvn.MakeConX(markOopDesc::always_locked_pattern); 2427 Node* is_value = _igvn.transform(new AndXNode(mark, value_mask)); 2428 Node* cmp = _igvn.transform(new CmpXNode(is_value, value_mask)); 2429 Node* bol = _igvn.transform(new BoolNode(cmp, BoolTest::eq)); 2430 Node* unc_ctrl = generate_slow_guard(&slow_path, bol, NULL); 2431 2432 int trap_request = Deoptimization::make_trap_request(Deoptimization::Reason_class_check, Deoptimization::Action_none); 2433 address call_addr = SharedRuntime::uncommon_trap_blob()->entry_point(); 2434 const TypePtr* no_memory_effects = NULL; 2435 JVMState* jvms = lock->jvms(); 2436 CallNode* unc = new CallStaticJavaNode(OptoRuntime::uncommon_trap_Type(), call_addr, "uncommon_trap", 2437 jvms->bci(), no_memory_effects); 2438 2439 unc->init_req(TypeFunc::Control, unc_ctrl); 2440 unc->init_req(TypeFunc::I_O, lock->i_o()); 2441 unc->init_req(TypeFunc::Memory, mem); // may gc ptrs 2442 unc->init_req(TypeFunc::FramePtr, lock->in(TypeFunc::FramePtr)); 2443 unc->init_req(TypeFunc::ReturnAdr, lock->in(TypeFunc::ReturnAdr)); 2444 unc->init_req(TypeFunc::Parms+0, _igvn.intcon(trap_request)); 2445 unc->set_cnt(PROB_UNLIKELY_MAG(4)); 2446 copy_call_debug_info(lock, unc); 2447 2448 assert(unc->peek_monitor_box() == box, "wrong monitor"); 2449 assert(unc->peek_monitor_obj() == obj, "wrong monitor"); 2450 2451 // pop monitor and push obj back on stack: we trap before the monitorenter 2452 unc->pop_monitor(); 2453 unc->grow_stack(unc->jvms(), 1); 2454 unc->set_stack(unc->jvms(), unc->jvms()->stk_size()-1, obj); 2455 2456 _igvn.register_new_node_with_optimizer(unc); 2457 2458 Node* ctrl = _igvn.transform(new ProjNode(unc, TypeFunc::Control)); 2459 Node* halt = _igvn.transform(new HaltNode(ctrl, lock->in(TypeFunc::FramePtr))); 2460 C->root()->add_req(halt); 2461 } 2462 2463 // Make slow path call 2464 CallNode *call = make_slow_call((CallNode *) lock, OptoRuntime::complete_monitor_enter_Type(), 2465 OptoRuntime::complete_monitor_locking_Java(), NULL, slow_path, 2466 obj, box, NULL); 2467 2468 extract_call_projections(call); 2469 2470 // Slow path can only throw asynchronous exceptions, which are always 2471 // de-opted. So the compiler thinks the slow-call can never throw an 2472 // exception. If it DOES throw an exception we would need the debug 2473 // info removed first (since if it throws there is no monitor). 2474 assert ( _ioproj_fallthrough == NULL && _ioproj_catchall == NULL && 2475 _memproj_catchall == NULL && _catchallcatchproj == NULL, "Unexpected projection from Lock"); 2476 2477 // Capture slow path 2478 // disconnect fall-through projection from call and create a new one 2479 // hook up users of fall-through projection to region 2480 Node *slow_ctrl = _fallthroughproj->clone(); 2481 transform_later(slow_ctrl); 2482 _igvn.hash_delete(_fallthroughproj); |