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