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