src/hotspot/share/opto/stringopts.cpp
changeset 48595 5d699d81c10c
parent 47216 71c04702a3d5
child 51333 f6641fcf7b7e
equal deleted inserted replaced
48594:4e4929530412 48595:5d699d81c10c
     1 /*
     1 /*
     2  * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   360   Compile* C = _stringopts->C;
   360   Compile* C = _stringopts->C;
   361 
   361 
   362   // Eliminate Initialize node.
   362   // Eliminate Initialize node.
   363   assert(init->outcnt() <= 2, "only a control and memory projection expected");
   363   assert(init->outcnt() <= 2, "only a control and memory projection expected");
   364   assert(init->req() <= InitializeNode::RawStores, "no pending inits");
   364   assert(init->req() <= InitializeNode::RawStores, "no pending inits");
   365   Node *ctrl_proj = init->proj_out(TypeFunc::Control);
   365   Node *ctrl_proj = init->proj_out_or_null(TypeFunc::Control);
   366   if (ctrl_proj != NULL) {
   366   if (ctrl_proj != NULL) {
   367     C->gvn_replace_by(ctrl_proj, init->in(TypeFunc::Control));
   367     C->gvn_replace_by(ctrl_proj, init->in(TypeFunc::Control));
   368   }
   368   }
   369   Node *mem_proj = init->proj_out(TypeFunc::Memory);
   369   Node *mem_proj = init->proj_out_or_null(TypeFunc::Memory);
   370   if (mem_proj != NULL) {
   370   if (mem_proj != NULL) {
   371     Node *mem = init->in(TypeFunc::Memory);
   371     Node *mem = init->in(TypeFunc::Memory);
   372     C->gvn_replace_by(mem_proj, mem);
   372     C->gvn_replace_by(mem_proj, mem);
   373   }
   373   }
   374   C->gvn_replace_by(init, C->top());
   374   C->gvn_replace_by(init, C->top());
   889     if (n->is_Call()) {
   889     if (n->is_Call()) {
   890       CallNode* cn = n->as_Call();
   890       CallNode* cn = n->as_Call();
   891       ctrl_path.push(cn);
   891       ctrl_path.push(cn);
   892       ctrl_path.push(cn->proj_out(0));
   892       ctrl_path.push(cn->proj_out(0));
   893       ctrl_path.push(cn->proj_out(0)->unique_out());
   893       ctrl_path.push(cn->proj_out(0)->unique_out());
   894       Node* catchproj = cn->proj_out(0)->unique_out()->as_Catch()->proj_out(0);
   894       Node* catchproj = cn->proj_out(0)->unique_out()->as_Catch()->proj_out_or_null(0);
   895       if (catchproj != NULL) {
   895       if (catchproj != NULL) {
   896         ctrl_path.push(catchproj);
   896         ctrl_path.push(catchproj);
   897       }
   897       }
   898     } else {
   898     } else {
   899       ShouldNotReachHere();
   899       ShouldNotReachHere();
  1033   // Validate that all these results produced are contained within
  1033   // Validate that all these results produced are contained within
  1034   // this cluster of objects.  First collect all the results produced
  1034   // this cluster of objects.  First collect all the results produced
  1035   // by calls in the region.
  1035   // by calls in the region.
  1036   _stringopts->_visited.Clear();
  1036   _stringopts->_visited.Clear();
  1037   Node_List worklist;
  1037   Node_List worklist;
  1038   Node* final_result = _end->proj_out(TypeFunc::Parms);
  1038   Node* final_result = _end->proj_out_or_null(TypeFunc::Parms);
  1039   for (uint i = 0; i < _control.size(); i++) {
  1039   for (uint i = 0; i < _control.size(); i++) {
  1040     CallNode* cnode = _control.at(i)->isa_Call();
  1040     CallNode* cnode = _control.at(i)->isa_Call();
  1041     if (cnode != NULL) {
  1041     if (cnode != NULL) {
  1042       _stringopts->_visited.test_set(cnode->_idx);
  1042       _stringopts->_visited.test_set(cnode->_idx);
  1043     }
  1043     }
  1044     Node* result = cnode != NULL ? cnode->proj_out(TypeFunc::Parms) : NULL;
  1044     Node* result = cnode != NULL ? cnode->proj_out_or_null(TypeFunc::Parms) : NULL;
  1045     if (result != NULL && result != final_result) {
  1045     if (result != NULL && result != final_result) {
  1046       worklist.push(result);
  1046       worklist.push(result);
  1047     }
  1047     }
  1048   }
  1048   }
  1049 
  1049