hotspot/src/share/vm/opto/graphKit.cpp
changeset 46525 3a5c833a43de
parent 43481 47657134c5c2
child 46542 73dd19b96b5d
equal deleted inserted replaced
46524:6954745f7af3 46525:3a5c833a43de
  1388     replace_in_map(obj, cast);
  1388     replace_in_map(obj, cast);
  1389 
  1389 
  1390   return cast;                  // Return casted value
  1390   return cast;                  // Return casted value
  1391 }
  1391 }
  1392 
  1392 
       
  1393 // Sometimes in intrinsics, we implicitly know an object is not null
       
  1394 // (there's no actual null check) so we can cast it to not null. In
       
  1395 // the course of optimizations, the input to the cast can become null.
       
  1396 // In that case that data path will die and we need the control path
       
  1397 // to become dead as well to keep the graph consistent. So we have to
       
  1398 // add a check for null for which one branch can't be taken. It uses
       
  1399 // an Opaque4 node that will cause the check to be removed after loop
       
  1400 // opts so the test goes away and the compiled code doesn't execute a
       
  1401 // useless check.
       
  1402 Node* GraphKit::must_be_not_null(Node* value, bool do_replace_in_map) {
       
  1403   Node* chk = _gvn.transform(new CmpPNode(value, null()));
       
  1404   Node *tst = _gvn.transform(new BoolNode(chk, BoolTest::ne));
       
  1405   Node* opaq = _gvn.transform(new Opaque4Node(C, tst, intcon(1)));
       
  1406   IfNode *iff = new IfNode(control(), opaq, PROB_MAX, COUNT_UNKNOWN);
       
  1407   _gvn.set_type(iff, iff->Value(&_gvn));
       
  1408   Node *if_f = _gvn.transform(new IfFalseNode(iff));
       
  1409   Node *frame = _gvn.transform(new ParmNode(C->start(), TypeFunc::FramePtr));
       
  1410   Node *halt = _gvn.transform(new HaltNode(if_f, frame));
       
  1411   C->root()->add_req(halt);
       
  1412   Node *if_t = _gvn.transform(new IfTrueNode(iff));
       
  1413   set_control(if_t);
       
  1414   return cast_not_null(value, do_replace_in_map);
       
  1415 }
       
  1416 
  1393 
  1417 
  1394 //--------------------------replace_in_map-------------------------------------
  1418 //--------------------------replace_in_map-------------------------------------
  1395 void GraphKit::replace_in_map(Node* old, Node* neww) {
  1419 void GraphKit::replace_in_map(Node* old, Node* neww) {
  1396   if (old == neww) {
  1420   if (old == neww) {
  1397     return;
  1421     return;