304 result->append(other->argument(y), other->mode(y));
305 }
306 } else {
307 result->append(argx, mode(x));
308 }
309 }
310 result->set_allocation(other->_begin);
311 for (uint i = 0; i < _constructors.size(); i++) {
312 result->add_constructor(_constructors.at(i));
313 }
314 for (uint i = 0; i < other->_constructors.size(); i++) {
315 result->add_constructor(other->_constructors.at(i));
316 }
317 result->_multiple = true;
318 return result;
319 }
320
321
322 void StringConcat::eliminate_call(CallNode* call) {
323 Compile* C = _stringopts->C;
324 CallProjections projs;
325 call->extract_projections(&projs, false);
326 if (projs.fallthrough_catchproj != nullptr) {
327 C->gvn_replace_by(projs.fallthrough_catchproj, call->in(TypeFunc::Control));
328 }
329 if (projs.fallthrough_memproj != nullptr) {
330 C->gvn_replace_by(projs.fallthrough_memproj, call->in(TypeFunc::Memory));
331 }
332 if (projs.catchall_memproj != nullptr) {
333 C->gvn_replace_by(projs.catchall_memproj, C->top());
334 }
335 if (projs.fallthrough_ioproj != nullptr) {
336 C->gvn_replace_by(projs.fallthrough_ioproj, call->in(TypeFunc::I_O));
337 }
338 if (projs.catchall_ioproj != nullptr) {
339 C->gvn_replace_by(projs.catchall_ioproj, C->top());
340 }
341 if (projs.catchall_catchproj != nullptr) {
342 // EA can't cope with the partially collapsed graph this
343 // creates so put it on the worklist to be collapsed later.
344 for (SimpleDUIterator i(projs.catchall_catchproj); i.has_next(); i.next()) {
345 Node *use = i.get();
346 int opc = use->Opcode();
347 if (opc == Op_CreateEx || opc == Op_Region) {
348 _stringopts->record_dead_node(use);
349 }
350 }
351 C->gvn_replace_by(projs.catchall_catchproj, C->top());
352 }
353 if (projs.resproj != nullptr) {
354 C->gvn_replace_by(projs.resproj, C->top());
355 }
356 C->gvn_replace_by(call, C->top());
357 }
358
359 void StringConcat::eliminate_initialize(InitializeNode* init) {
360 Compile* C = _stringopts->C;
361
362 // Eliminate Initialize node.
363 assert(init->outcnt() <= 2, "only a control and memory projection expected");
364 assert(init->req() <= InitializeNode::RawStores, "no pending inits");
365 Node *ctrl_proj = init->proj_out_or_null(TypeFunc::Control);
366 if (ctrl_proj != nullptr) {
367 C->gvn_replace_by(ctrl_proj, init->in(TypeFunc::Control));
368 }
369 Node *mem_proj = init->proj_out_or_null(TypeFunc::Memory);
370 if (mem_proj != nullptr) {
371 Node *mem = init->in(TypeFunc::Memory);
372 C->gvn_replace_by(mem_proj, mem);
373 }
374 C->gvn_replace_by(init, C->top());
|
304 result->append(other->argument(y), other->mode(y));
305 }
306 } else {
307 result->append(argx, mode(x));
308 }
309 }
310 result->set_allocation(other->_begin);
311 for (uint i = 0; i < _constructors.size(); i++) {
312 result->add_constructor(_constructors.at(i));
313 }
314 for (uint i = 0; i < other->_constructors.size(); i++) {
315 result->add_constructor(other->_constructors.at(i));
316 }
317 result->_multiple = true;
318 return result;
319 }
320
321
322 void StringConcat::eliminate_call(CallNode* call) {
323 Compile* C = _stringopts->C;
324 CallProjections* projs = call->extract_projections(false);
325 if (projs->fallthrough_catchproj != nullptr) {
326 C->gvn_replace_by(projs->fallthrough_catchproj, call->in(TypeFunc::Control));
327 }
328 if (projs->fallthrough_memproj != nullptr) {
329 C->gvn_replace_by(projs->fallthrough_memproj, call->in(TypeFunc::Memory));
330 }
331 if (projs->catchall_memproj != nullptr) {
332 C->gvn_replace_by(projs->catchall_memproj, C->top());
333 }
334 if (projs->fallthrough_ioproj != nullptr) {
335 C->gvn_replace_by(projs->fallthrough_ioproj, call->in(TypeFunc::I_O));
336 }
337 if (projs->catchall_ioproj != nullptr) {
338 C->gvn_replace_by(projs->catchall_ioproj, C->top());
339 }
340 if (projs->catchall_catchproj != nullptr) {
341 // EA can't cope with the partially collapsed graph this
342 // creates so put it on the worklist to be collapsed later.
343 for (SimpleDUIterator i(projs->catchall_catchproj); i.has_next(); i.next()) {
344 Node *use = i.get();
345 int opc = use->Opcode();
346 if (opc == Op_CreateEx || opc == Op_Region) {
347 _stringopts->record_dead_node(use);
348 }
349 }
350 C->gvn_replace_by(projs->catchall_catchproj, C->top());
351 }
352 if (projs->resproj[0] != nullptr) {
353 assert(projs->nb_resproj == 1, "unexpected number of results");
354 C->gvn_replace_by(projs->resproj[0], C->top());
355 }
356 C->gvn_replace_by(call, C->top());
357 }
358
359 void StringConcat::eliminate_initialize(InitializeNode* init) {
360 Compile* C = _stringopts->C;
361
362 // Eliminate Initialize node.
363 assert(init->outcnt() <= 2, "only a control and memory projection expected");
364 assert(init->req() <= InitializeNode::RawStores, "no pending inits");
365 Node *ctrl_proj = init->proj_out_or_null(TypeFunc::Control);
366 if (ctrl_proj != nullptr) {
367 C->gvn_replace_by(ctrl_proj, init->in(TypeFunc::Control));
368 }
369 Node *mem_proj = init->proj_out_or_null(TypeFunc::Memory);
370 if (mem_proj != nullptr) {
371 Node *mem = init->in(TypeFunc::Memory);
372 C->gvn_replace_by(mem_proj, mem);
373 }
374 C->gvn_replace_by(init, C->top());
|