< prev index next >

src/hotspot/share/opto/macro.cpp

Print this page

2183   // Slow path can only throw asynchronous exceptions, which are always
2184   // de-opted.  So the compiler thinks the slow-call can never throw an
2185   // exception.  If it DOES throw an exception we would need the debug
2186   // info removed first (since if it throws there is no monitor).
2187   assert(_callprojs.fallthrough_ioproj == NULL && _callprojs.catchall_ioproj == NULL &&
2188          _callprojs.catchall_memproj == NULL && _callprojs.catchall_catchproj == NULL, "Unexpected projection from Lock");
2189 
2190   // Capture slow path
2191   // disconnect fall-through projection from call and create a new one
2192   // hook up users of fall-through projection to region
2193   Node *slow_ctrl = _callprojs.fallthrough_proj->clone();
2194   transform_later(slow_ctrl);
2195   _igvn.hash_delete(_callprojs.fallthrough_proj);
2196   _callprojs.fallthrough_proj->disconnect_inputs(C);
2197   region->init_req(1, slow_ctrl);
2198   // region inputs are now complete
2199   transform_later(region);
2200   _igvn.replace_node(_callprojs.fallthrough_proj, region);
2201 
2202   Node *memproj = transform_later(new ProjNode(call, TypeFunc::Memory));
2203   mem_phi->init_req(1, memproj );







2204   transform_later(mem_phi);
2205   _igvn.replace_node(_callprojs.fallthrough_memproj, mem_phi);






2206 }
2207 
2208 //------------------------------expand_unlock_node----------------------
2209 void PhaseMacroExpand::expand_unlock_node(UnlockNode *unlock) {
2210 
2211   Node* ctrl = unlock->in(TypeFunc::Control);
2212   Node* mem = unlock->in(TypeFunc::Memory);
2213   Node* obj = unlock->obj_node();
2214   Node* box = unlock->box_node();
2215 
2216   assert(!box->as_BoxLock()->is_eliminated(), "sanity");
2217 
2218   // No need for a null check on unlock
2219 
2220   // Make the merge point
2221   Node *region;
2222   Node *mem_phi;
2223 
2224   region  = new RegionNode(3);
2225   // create a Phi for the memory state

2239   assert(_callprojs.fallthrough_ioproj == NULL && _callprojs.catchall_ioproj == NULL &&
2240          _callprojs.catchall_memproj == NULL && _callprojs.catchall_catchproj == NULL, "Unexpected projection from Lock");
2241 
2242   // No exceptions for unlocking
2243   // Capture slow path
2244   // disconnect fall-through projection from call and create a new one
2245   // hook up users of fall-through projection to region
2246   Node *slow_ctrl = _callprojs.fallthrough_proj->clone();
2247   transform_later(slow_ctrl);
2248   _igvn.hash_delete(_callprojs.fallthrough_proj);
2249   _callprojs.fallthrough_proj->disconnect_inputs(C);
2250   region->init_req(1, slow_ctrl);
2251   // region inputs are now complete
2252   transform_later(region);
2253   _igvn.replace_node(_callprojs.fallthrough_proj, region);
2254 
2255   Node *memproj = transform_later(new ProjNode(call, TypeFunc::Memory) );
2256   mem_phi->init_req(1, memproj );
2257   mem_phi->init_req(2, mem);
2258   transform_later(mem_phi);
2259   _igvn.replace_node(_callprojs.fallthrough_memproj, mem_phi);





2260 }
2261 
2262 void PhaseMacroExpand::expand_subtypecheck_node(SubTypeCheckNode *check) {
2263   assert(check->in(SubTypeCheckNode::Control) == NULL, "should be pinned");
2264   Node* bol = check->unique_out();
2265   Node* obj_or_subklass = check->in(SubTypeCheckNode::ObjOrSubKlass);
2266   Node* superklass = check->in(SubTypeCheckNode::SuperKlass);
2267   assert(bol->is_Bool() && bol->as_Bool()->_test._test == BoolTest::ne, "unexpected bool node");
2268 
2269   for (DUIterator_Last imin, i = bol->last_outs(imin); i >= imin; --i) {
2270     Node* iff = bol->last_out(i);
2271     assert(iff->is_If(), "where's the if?");
2272 
2273     if (iff->in(0)->is_top()) {
2274       _igvn.replace_input_of(iff, 1, C->top());
2275       continue;
2276     }
2277 
2278     Node* iftrue = iff->as_If()->proj_out(1);
2279     Node* iffalse = iff->as_If()->proj_out(0);

2183   // Slow path can only throw asynchronous exceptions, which are always
2184   // de-opted.  So the compiler thinks the slow-call can never throw an
2185   // exception.  If it DOES throw an exception we would need the debug
2186   // info removed first (since if it throws there is no monitor).
2187   assert(_callprojs.fallthrough_ioproj == NULL && _callprojs.catchall_ioproj == NULL &&
2188          _callprojs.catchall_memproj == NULL && _callprojs.catchall_catchproj == NULL, "Unexpected projection from Lock");
2189 
2190   // Capture slow path
2191   // disconnect fall-through projection from call and create a new one
2192   // hook up users of fall-through projection to region
2193   Node *slow_ctrl = _callprojs.fallthrough_proj->clone();
2194   transform_later(slow_ctrl);
2195   _igvn.hash_delete(_callprojs.fallthrough_proj);
2196   _callprojs.fallthrough_proj->disconnect_inputs(C);
2197   region->init_req(1, slow_ctrl);
2198   // region inputs are now complete
2199   transform_later(region);
2200   _igvn.replace_node(_callprojs.fallthrough_proj, region);
2201 
2202   Node *memproj = transform_later(new ProjNode(call, TypeFunc::Memory));
2203 
2204   // held_monitor_count increased in slowpath (complete_monitor_locking_C_inc_held_monitor_count), need compensate a decreament here
2205   // this minimizes control flow changes here and add redundant count updates only in slowpath
2206   Node* thread = transform_later(new ThreadLocalNode());
2207   Node* dec_count = make_load(slow_ctrl, memproj, thread, in_bytes(JavaThread::held_monitor_count_offset()), TypeInt::INT, TypeInt::INT->basic_type());
2208   Node* new_dec_count = transform_later(new SubINode(dec_count, intcon(1)));
2209   Node *compensate_dec = make_store(slow_ctrl, memproj, thread, in_bytes(JavaThread::held_monitor_count_offset()), new_dec_count, T_INT);
2210   mem_phi->init_req(1, compensate_dec);
2211   transform_later(mem_phi);
2212 
2213   // held_monitor_count increases in all path's post-dominate
2214   Node* inc_count = make_load(region, mem_phi, thread, in_bytes(JavaThread::held_monitor_count_offset()), TypeInt::INT, TypeInt::INT->basic_type());
2215   Node* new_inc_count = transform_later(new AddINode(inc_count, intcon(1)));
2216   Node *store = make_store(region, mem_phi, thread, in_bytes(JavaThread::held_monitor_count_offset()), new_inc_count, T_INT);
2217 
2218   _igvn.replace_node(_callprojs.fallthrough_memproj, store);
2219 }
2220 
2221 //------------------------------expand_unlock_node----------------------
2222 void PhaseMacroExpand::expand_unlock_node(UnlockNode *unlock) {
2223 
2224   Node* ctrl = unlock->in(TypeFunc::Control);
2225   Node* mem = unlock->in(TypeFunc::Memory);
2226   Node* obj = unlock->obj_node();
2227   Node* box = unlock->box_node();
2228 
2229   assert(!box->as_BoxLock()->is_eliminated(), "sanity");
2230 
2231   // No need for a null check on unlock
2232 
2233   // Make the merge point
2234   Node *region;
2235   Node *mem_phi;
2236 
2237   region  = new RegionNode(3);
2238   // create a Phi for the memory state

2252   assert(_callprojs.fallthrough_ioproj == NULL && _callprojs.catchall_ioproj == NULL &&
2253          _callprojs.catchall_memproj == NULL && _callprojs.catchall_catchproj == NULL, "Unexpected projection from Lock");
2254 
2255   // No exceptions for unlocking
2256   // Capture slow path
2257   // disconnect fall-through projection from call and create a new one
2258   // hook up users of fall-through projection to region
2259   Node *slow_ctrl = _callprojs.fallthrough_proj->clone();
2260   transform_later(slow_ctrl);
2261   _igvn.hash_delete(_callprojs.fallthrough_proj);
2262   _callprojs.fallthrough_proj->disconnect_inputs(C);
2263   region->init_req(1, slow_ctrl);
2264   // region inputs are now complete
2265   transform_later(region);
2266   _igvn.replace_node(_callprojs.fallthrough_proj, region);
2267 
2268   Node *memproj = transform_later(new ProjNode(call, TypeFunc::Memory) );
2269   mem_phi->init_req(1, memproj );
2270   mem_phi->init_req(2, mem);
2271   transform_later(mem_phi);
2272 
2273   Node* count = make_load(region, mem_phi, thread, in_bytes(JavaThread::held_monitor_count_offset()), TypeInt::INT, TypeInt::INT->basic_type());
2274   Node* newcount = transform_later(new SubINode(count, intcon(1)));
2275   Node *store = make_store(region, mem_phi, thread, in_bytes(JavaThread::held_monitor_count_offset()), newcount, T_INT);
2276 
2277   _igvn.replace_node(_callprojs.fallthrough_memproj, store);
2278 }
2279 
2280 void PhaseMacroExpand::expand_subtypecheck_node(SubTypeCheckNode *check) {
2281   assert(check->in(SubTypeCheckNode::Control) == NULL, "should be pinned");
2282   Node* bol = check->unique_out();
2283   Node* obj_or_subklass = check->in(SubTypeCheckNode::ObjOrSubKlass);
2284   Node* superklass = check->in(SubTypeCheckNode::SuperKlass);
2285   assert(bol->is_Bool() && bol->as_Bool()->_test._test == BoolTest::ne, "unexpected bool node");
2286 
2287   for (DUIterator_Last imin, i = bol->last_outs(imin); i >= imin; --i) {
2288     Node* iff = bol->last_out(i);
2289     assert(iff->is_If(), "where's the if?");
2290 
2291     if (iff->in(0)->is_top()) {
2292       _igvn.replace_input_of(iff, 1, C->top());
2293       continue;
2294     }
2295 
2296     Node* iftrue = iff->as_If()->proj_out(1);
2297     Node* iffalse = iff->as_If()->proj_out(0);
< prev index next >