< prev index next >

src/hotspot/share/opto/stringopts.cpp

Print this page

 324         tty->print_cr("Merge candidate of length %d exceeds argument limit", arguments_appended);
 325       }
 326 #endif
 327       return nullptr;
 328     }
 329   }
 330   result->set_allocation(other->_begin);
 331   for (uint i = 0; i < _constructors.size(); i++) {
 332     result->add_constructor(_constructors.at(i));
 333   }
 334   for (uint i = 0; i < other->_constructors.size(); i++) {
 335     result->add_constructor(other->_constructors.at(i));
 336   }
 337   result->_multiple = true;
 338   return result;
 339 }
 340 
 341 
 342 void StringConcat::eliminate_call(CallNode* call) {
 343   Compile* C = _stringopts->C;
 344   CallProjections projs;
 345   call->extract_projections(&projs, false);
 346   if (projs.fallthrough_catchproj != nullptr) {
 347     C->gvn_replace_by(projs.fallthrough_catchproj, call->in(TypeFunc::Control));
 348   }
 349   if (projs.fallthrough_memproj != nullptr) {
 350     C->gvn_replace_by(projs.fallthrough_memproj, call->in(TypeFunc::Memory));
 351   }
 352   if (projs.catchall_memproj != nullptr) {
 353     C->gvn_replace_by(projs.catchall_memproj, C->top());
 354   }
 355   if (projs.fallthrough_ioproj != nullptr) {
 356     C->gvn_replace_by(projs.fallthrough_ioproj, call->in(TypeFunc::I_O));
 357   }
 358   if (projs.catchall_ioproj != nullptr) {
 359     C->gvn_replace_by(projs.catchall_ioproj, C->top());
 360   }
 361   if (projs.catchall_catchproj != nullptr) {
 362     // EA can't cope with the partially collapsed graph this
 363     // creates so put it on the worklist to be collapsed later.
 364     for (SimpleDUIterator i(projs.catchall_catchproj); i.has_next(); i.next()) {
 365       Node *use = i.get();
 366       int opc = use->Opcode();
 367       if (opc == Op_CreateEx || opc == Op_Region) {
 368         _stringopts->record_dead_node(use);
 369       }
 370     }
 371     C->gvn_replace_by(projs.catchall_catchproj, C->top());
 372   }
 373   if (projs.resproj != nullptr) {
 374     C->gvn_replace_by(projs.resproj, C->top());

 375   }
 376   C->gvn_replace_by(call, C->top());
 377 }
 378 
 379 void StringConcat::eliminate_initialize(InitializeNode* init) {
 380   Compile* C = _stringopts->C;
 381 
 382   // Eliminate Initialize node.
 383   assert(init->req() <= InitializeNode::RawStores, "no pending inits");
 384   Node *ctrl_proj = init->proj_out_or_null(TypeFunc::Control);
 385   if (ctrl_proj != nullptr) {
 386     C->gvn_replace_by(ctrl_proj, init->in(TypeFunc::Control));
 387   }
 388   Node* mem = init->in(TypeFunc::Memory);
 389   init->replace_mem_projs_by(mem, C);
 390   C->gvn_replace_by(init, C->top());
 391   init->disconnect_inputs(C);
 392 }
 393 
 394 Node_List PhaseStringOpts::collect_toString_calls() {

1135     }
1136   }
1137 
1138   Node* last_result = nullptr;
1139   while (worklist.size() > 0) {
1140     Node* result = worklist.pop();
1141     if (_stringopts->_visited.test_set(result->_idx))
1142       continue;
1143     for (SimpleDUIterator i(result); i.has_next(); i.next()) {
1144       Node *use = i.get();
1145       if (ctrl_path.member(use)) {
1146         // already checked this
1147         continue;
1148       }
1149       int opc = use->Opcode();
1150       if (opc == Op_CmpP || opc == Op_Node) {
1151         ctrl_path.push(use);
1152         continue;
1153       }
1154       if (opc == Op_CastPP || opc == Op_CheckCastPP) {



1155         for (SimpleDUIterator j(use); j.has_next(); j.next()) {
1156           worklist.push(j.get());
1157         }
1158         worklist.push(use->in(1));
1159         ctrl_path.push(use);
1160         continue;
1161       }
1162 #ifndef PRODUCT
1163       if (PrintOptimizeStringConcat) {
1164         if (result != last_result) {
1165           last_result = result;
1166           tty->print_cr("extra uses for result:");
1167           last_result->dump();
1168         }
1169         use->dump();
1170       }
1171 #endif
1172       fail = true;
1173       break;
1174     }

 324         tty->print_cr("Merge candidate of length %d exceeds argument limit", arguments_appended);
 325       }
 326 #endif
 327       return nullptr;
 328     }
 329   }
 330   result->set_allocation(other->_begin);
 331   for (uint i = 0; i < _constructors.size(); i++) {
 332     result->add_constructor(_constructors.at(i));
 333   }
 334   for (uint i = 0; i < other->_constructors.size(); i++) {
 335     result->add_constructor(other->_constructors.at(i));
 336   }
 337   result->_multiple = true;
 338   return result;
 339 }
 340 
 341 
 342 void StringConcat::eliminate_call(CallNode* call) {
 343   Compile* C = _stringopts->C;
 344   CallProjections* projs = call->extract_projections(false);
 345   if (projs->fallthrough_catchproj != nullptr) {
 346     C->gvn_replace_by(projs->fallthrough_catchproj, call->in(TypeFunc::Control));

 347   }
 348   if (projs->fallthrough_memproj != nullptr) {
 349     C->gvn_replace_by(projs->fallthrough_memproj, call->in(TypeFunc::Memory));
 350   }
 351   if (projs->catchall_memproj != nullptr) {
 352     C->gvn_replace_by(projs->catchall_memproj, C->top());
 353   }
 354   if (projs->fallthrough_ioproj != nullptr) {
 355     C->gvn_replace_by(projs->fallthrough_ioproj, call->in(TypeFunc::I_O));
 356   }
 357   if (projs->catchall_ioproj != nullptr) {
 358     C->gvn_replace_by(projs->catchall_ioproj, C->top());
 359   }
 360   if (projs->catchall_catchproj != nullptr) {
 361     // EA can't cope with the partially collapsed graph this
 362     // creates so put it on the worklist to be collapsed later.
 363     for (SimpleDUIterator i(projs->catchall_catchproj); i.has_next(); i.next()) {
 364       Node *use = i.get();
 365       int opc = use->Opcode();
 366       if (opc == Op_CreateEx || opc == Op_Region) {
 367         _stringopts->record_dead_node(use);
 368       }
 369     }
 370     C->gvn_replace_by(projs->catchall_catchproj, C->top());
 371   }
 372   if (projs->resproj[0] != nullptr) {
 373     assert(projs->nb_resproj == 1, "unexpected number of results");
 374     C->gvn_replace_by(projs->resproj[0], C->top());
 375   }
 376   C->gvn_replace_by(call, C->top());
 377 }
 378 
 379 void StringConcat::eliminate_initialize(InitializeNode* init) {
 380   Compile* C = _stringopts->C;
 381 
 382   // Eliminate Initialize node.
 383   assert(init->req() <= InitializeNode::RawStores, "no pending inits");
 384   Node *ctrl_proj = init->proj_out_or_null(TypeFunc::Control);
 385   if (ctrl_proj != nullptr) {
 386     C->gvn_replace_by(ctrl_proj, init->in(TypeFunc::Control));
 387   }
 388   Node* mem = init->in(TypeFunc::Memory);
 389   init->replace_mem_projs_by(mem, C);
 390   C->gvn_replace_by(init, C->top());
 391   init->disconnect_inputs(C);
 392 }
 393 
 394 Node_List PhaseStringOpts::collect_toString_calls() {

1135     }
1136   }
1137 
1138   Node* last_result = nullptr;
1139   while (worklist.size() > 0) {
1140     Node* result = worklist.pop();
1141     if (_stringopts->_visited.test_set(result->_idx))
1142       continue;
1143     for (SimpleDUIterator i(result); i.has_next(); i.next()) {
1144       Node *use = i.get();
1145       if (ctrl_path.member(use)) {
1146         // already checked this
1147         continue;
1148       }
1149       int opc = use->Opcode();
1150       if (opc == Op_CmpP || opc == Op_Node) {
1151         ctrl_path.push(use);
1152         continue;
1153       }
1154       if (opc == Op_CastPP || opc == Op_CheckCastPP) {
1155         if (opc == Op_CheckCastPP) {
1156           worklist.push(use);
1157         }
1158         for (SimpleDUIterator j(use); j.has_next(); j.next()) {
1159           worklist.push(j.get());
1160         }
1161         worklist.push(use->in(1));
1162         ctrl_path.push(use);
1163         continue;
1164       }
1165 #ifndef PRODUCT
1166       if (PrintOptimizeStringConcat) {
1167         if (result != last_result) {
1168           last_result = result;
1169           tty->print_cr("extra uses for result:");
1170           last_result->dump();
1171         }
1172         use->dump();
1173       }
1174 #endif
1175       fail = true;
1176       break;
1177     }
< prev index next >