< prev index next >

src/share/vm/opto/macro.cpp

Print this page




 363         // Can not bypass initialization of the instance
 364         // we are looking.
 365         debug_only(intptr_t offset;)
 366         assert(alloc == AllocateNode::Ideal_allocation(mem->in(3), phase, offset), "sanity");
 367         InitializeNode* init = alloc->as_Allocate()->initialization();
 368         // We are looking for stored value, return Initialize node
 369         // or memory edge from Allocate node.
 370         if (init != NULL)
 371           return init;
 372         else
 373           return alloc->in(TypeFunc::Memory); // It will produce zero value (see callers).
 374       }
 375       // Otherwise skip it (the call updated 'mem' value).
 376     } else if (mem->Opcode() == Op_SCMemProj) {
 377       mem = mem->in(0);
 378       Node* adr = NULL;
 379       if (mem->is_LoadStore()) {
 380         adr = mem->in(MemNode::Address);
 381       } else {
 382         assert(mem->Opcode() == Op_EncodeISOArray ||

 383                mem->Opcode() == Op_StrCompressedCopy, "sanity");
 384         adr = mem->in(3); // Destination array
 385       }
 386       const TypePtr* atype = adr->bottom_type()->is_ptr();
 387       int adr_idx = phase->C->get_alias_index(atype);
 388       if (adr_idx == alias_idx) {
 389         DEBUG_ONLY(mem->dump();)
 390         assert(false, "Object is not scalar replaceable if a LoadStore node accesses its field");
 391         return NULL;
 392       }
 393       mem = mem->in(MemNode::Memory);
 394    } else if (mem->Opcode() == Op_StrInflatedCopy) {
 395       Node* adr = mem->in(3); // Destination array
 396       const TypePtr* atype = adr->bottom_type()->is_ptr();
 397       int adr_idx = phase->C->get_alias_index(atype);
 398       if (adr_idx == alias_idx) {
 399         DEBUG_ONLY(mem->dump();)
 400         assert(false, "Object is not scalar replaceable if a StrInflatedCopy node accesses its field");
 401         return NULL;
 402       }
 403       mem = mem->in(MemNode::Memory);
 404     } else {
 405       return mem;
 406     }
 407     assert(mem != orig_mem, "dead memory loop");
 408   }
 409 }
 410 
 411 // Generate loads from source of the arraycopy for fields of
 412 // destination needed at a deoptimization point
 413 Node* PhaseMacroExpand::make_arraycopy_load(ArrayCopyNode* ac, intptr_t offset, Node* ctl, BasicType ft, const Type *ftype, AllocateNode *alloc) {
 414   BasicType bt = ft;
 415   const Type *type = ftype;
 416   if (ft == T_NARROWOOP) {
 417     bt = T_OBJECT;
 418     type = ftype->make_oopptr();
 419   }
 420   Node* res = NULL;
 421   if (ac->is_clonebasic()) {
 422     Node* base = ac->in(ArrayCopyNode::Src)->in(AddPNode::Base);
 423     Node* adr = _igvn.transform(new AddPNode(base, base, MakeConX(offset)));


 513         val = val->as_Initialize()->find_captured_store(offset, type2aelembytes(ft), &_igvn);
 514       }
 515       if (val == NULL) {
 516         return NULL;  // can't find a value on this path
 517       }
 518       if (val == mem) {
 519         values.at_put(j, mem);
 520       } else if (val->is_Store()) {
 521         values.at_put(j, val->in(MemNode::ValueIn));
 522       } else if(val->is_Proj() && val->in(0) == alloc) {
 523         values.at_put(j, _igvn.zerocon(ft));
 524       } else if (val->is_Phi()) {
 525         val = value_from_mem_phi(val, ft, phi_type, adr_t, alloc, value_phis, level-1);
 526         if (val == NULL) {
 527           return NULL;
 528         }
 529         values.at_put(j, val);
 530       } else if (val->Opcode() == Op_SCMemProj) {
 531         assert(val->in(0)->is_LoadStore() ||
 532                val->in(0)->Opcode() == Op_EncodeISOArray ||

 533                val->in(0)->Opcode() == Op_StrCompressedCopy, "sanity");
 534         assert(false, "Object is not scalar replaceable if a LoadStore node accesses its field");
 535         return NULL;
 536       } else if (val->is_ArrayCopy()) {
 537         Node* res = make_arraycopy_load(val->as_ArrayCopy(), offset, val->in(0), ft, phi_type, alloc);
 538         if (res == NULL) {
 539           return NULL;
 540         }
 541         values.at_put(j, res);
 542       } else {
 543 #ifdef ASSERT
 544         val->dump();
 545         assert(false, "unknown node on this path");
 546 #endif
 547         return NULL;  // unknown node on this path
 548       }
 549     }
 550   }
 551   // Set Phi's inputs
 552   for (uint j = 1; j < length; j++) {




 363         // Can not bypass initialization of the instance
 364         // we are looking.
 365         debug_only(intptr_t offset;)
 366         assert(alloc == AllocateNode::Ideal_allocation(mem->in(3), phase, offset), "sanity");
 367         InitializeNode* init = alloc->as_Allocate()->initialization();
 368         // We are looking for stored value, return Initialize node
 369         // or memory edge from Allocate node.
 370         if (init != NULL)
 371           return init;
 372         else
 373           return alloc->in(TypeFunc::Memory); // It will produce zero value (see callers).
 374       }
 375       // Otherwise skip it (the call updated 'mem' value).
 376     } else if (mem->Opcode() == Op_SCMemProj) {
 377       mem = mem->in(0);
 378       Node* adr = NULL;
 379       if (mem->is_LoadStore()) {
 380         adr = mem->in(MemNode::Address);
 381       } else {
 382         assert(mem->Opcode() == Op_EncodeISOArray ||
 383                mem->Opcode() == Op_StrInflatedCopy ||
 384                mem->Opcode() == Op_StrCompressedCopy, "sanity");
 385         adr = mem->in(3); // Destination array
 386       }
 387       const TypePtr* atype = adr->bottom_type()->is_ptr();
 388       int adr_idx = phase->C->get_alias_index(atype);
 389       if (adr_idx == alias_idx) {
 390         DEBUG_ONLY(mem->dump();)
 391         assert(false, "Object is not scalar replaceable if a LoadStore node accesses its field");
 392         return NULL;
 393       }
 394       mem = mem->in(MemNode::Memory);










 395    } else {
 396       return mem;
 397     }
 398     assert(mem != orig_mem, "dead memory loop");
 399   }
 400 }
 401 
 402 // Generate loads from source of the arraycopy for fields of
 403 // destination needed at a deoptimization point
 404 Node* PhaseMacroExpand::make_arraycopy_load(ArrayCopyNode* ac, intptr_t offset, Node* ctl, BasicType ft, const Type *ftype, AllocateNode *alloc) {
 405   BasicType bt = ft;
 406   const Type *type = ftype;
 407   if (ft == T_NARROWOOP) {
 408     bt = T_OBJECT;
 409     type = ftype->make_oopptr();
 410   }
 411   Node* res = NULL;
 412   if (ac->is_clonebasic()) {
 413     Node* base = ac->in(ArrayCopyNode::Src)->in(AddPNode::Base);
 414     Node* adr = _igvn.transform(new AddPNode(base, base, MakeConX(offset)));


 504         val = val->as_Initialize()->find_captured_store(offset, type2aelembytes(ft), &_igvn);
 505       }
 506       if (val == NULL) {
 507         return NULL;  // can't find a value on this path
 508       }
 509       if (val == mem) {
 510         values.at_put(j, mem);
 511       } else if (val->is_Store()) {
 512         values.at_put(j, val->in(MemNode::ValueIn));
 513       } else if(val->is_Proj() && val->in(0) == alloc) {
 514         values.at_put(j, _igvn.zerocon(ft));
 515       } else if (val->is_Phi()) {
 516         val = value_from_mem_phi(val, ft, phi_type, adr_t, alloc, value_phis, level-1);
 517         if (val == NULL) {
 518           return NULL;
 519         }
 520         values.at_put(j, val);
 521       } else if (val->Opcode() == Op_SCMemProj) {
 522         assert(val->in(0)->is_LoadStore() ||
 523                val->in(0)->Opcode() == Op_EncodeISOArray ||
 524                val->in(0)->Opcode() == Op_StrInflatedCopy ||
 525                val->in(0)->Opcode() == Op_StrCompressedCopy, "sanity");
 526         assert(false, "Object is not scalar replaceable if a LoadStore node accesses its field");
 527         return NULL;
 528       } else if (val->is_ArrayCopy()) {
 529         Node* res = make_arraycopy_load(val->as_ArrayCopy(), offset, val->in(0), ft, phi_type, alloc);
 530         if (res == NULL) {
 531           return NULL;
 532         }
 533         values.at_put(j, res);
 534       } else {
 535 #ifdef ASSERT
 536         val->dump();
 537         assert(false, "unknown node on this path");
 538 #endif
 539         return NULL;  // unknown node on this path
 540       }
 541     }
 542   }
 543   // Set Phi's inputs
 544   for (uint j = 1; j < length; j++) {


< prev index next >