< prev index next >

src/hotspot/share/opto/memnode.cpp

Print this page




 907   Node* ld_adr = in(MemNode::Address);
 908   intptr_t ld_off = 0;
 909   AllocateNode* ld_alloc = AllocateNode::Ideal_allocation(ld_adr, phase, ld_off);
 910   Node* ac = find_previous_arraycopy(phase, ld_alloc, st, true);
 911   if (ac != NULL) {
 912     assert(ac->is_ArrayCopy(), "what kind of node can this be?");
 913 
 914     Node* mem = ac->in(TypeFunc::Memory);
 915     Node* ctl = ac->in(0);
 916     Node* src = ac->in(ArrayCopyNode::Src);
 917 
 918     if (!ac->as_ArrayCopy()->is_clonebasic() && !phase->type(src)->isa_aryptr()) {
 919       return NULL;
 920     }
 921 
 922     LoadNode* ld = clone()->as_Load();
 923     Node* addp = in(MemNode::Address)->clone();
 924     if (ac->as_ArrayCopy()->is_clonebasic()) {
 925       assert(ld_alloc != NULL, "need an alloc");
 926       assert(addp->is_AddP(), "address must be addp");
 927       assert(addp->in(AddPNode::Base) == ac->in(ArrayCopyNode::Dest)->in(AddPNode::Base), "strange pattern");
 928       assert(addp->in(AddPNode::Address) == ac->in(ArrayCopyNode::Dest)->in(AddPNode::Address), "strange pattern");


 929       addp->set_req(AddPNode::Base, src->in(AddPNode::Base));
 930       addp->set_req(AddPNode::Address, src->in(AddPNode::Address));
 931     } else {
 932       assert(ac->as_ArrayCopy()->is_arraycopy_validated() ||
 933              ac->as_ArrayCopy()->is_copyof_validated() ||
 934              ac->as_ArrayCopy()->is_copyofrange_validated(), "only supported cases");
 935       assert(addp->in(AddPNode::Base) == addp->in(AddPNode::Address), "should be");
 936       addp->set_req(AddPNode::Base, src);
 937       addp->set_req(AddPNode::Address, src);
 938 
 939       const TypeAryPtr* ary_t = phase->type(in(MemNode::Address))->isa_aryptr();
 940       BasicType ary_elem  = ary_t->klass()->as_array_klass()->element_type()->basic_type();
 941       uint header = arrayOopDesc::base_offset_in_bytes(ary_elem);
 942       uint shift  = exact_log2(type2aelembytes(ary_elem));
 943 
 944       Node* diff = phase->transform(new SubINode(ac->in(ArrayCopyNode::SrcPos), ac->in(ArrayCopyNode::DestPos)));
 945 #ifdef _LP64
 946       diff = phase->transform(new ConvI2LNode(diff));
 947 #endif
 948       diff = phase->transform(new LShiftXNode(diff, phase->intcon(shift)));


1064     }
1065 
1066     // A load from an initialization barrier can match a captured store.
1067     if (st->is_Proj() && st->in(0)->is_Initialize()) {
1068       InitializeNode* init = st->in(0)->as_Initialize();
1069       AllocateNode* alloc = init->allocation();
1070       if ((alloc != NULL) && (alloc == ld_alloc)) {
1071         // examine a captured store value
1072         st = init->find_captured_store(ld_off, memory_size(), phase);
1073         if (st != NULL) {
1074           continue;             // take one more trip around
1075         }
1076       }
1077     }
1078 
1079     // Load boxed value from result of valueOf() call is input parameter.
1080     if (this->is_Load() && ld_adr->is_AddP() &&
1081         (tp != NULL) && tp->is_ptr_to_boxed_value()) {
1082       intptr_t ignore = 0;
1083       Node* base = AddPNode::Ideal_base_and_offset(ld_adr, phase, ignore);


1084       if (base != NULL && base->is_Proj() &&
1085           base->as_Proj()->_con == TypeFunc::Parms &&
1086           base->in(0)->is_CallStaticJava() &&
1087           base->in(0)->as_CallStaticJava()->is_boxing_method()) {
1088         return base->in(0)->in(TypeFunc::Parms);
1089       }
1090     }
1091 
1092     break;
1093   }
1094 
1095   return NULL;
1096 }
1097 
1098 //----------------------is_instance_field_load_with_local_phi------------------
1099 bool LoadNode::is_instance_field_load_with_local_phi(Node* ctrl) {
1100   if( in(Memory)->is_Phi() && in(Memory)->in(0) == ctrl &&
1101       in(Address)->is_AddP() ) {
1102     const TypeOopPtr* t_oop = in(Address)->bottom_type()->isa_oopptr();
1103     // Only instances and boxed values.




 907   Node* ld_adr = in(MemNode::Address);
 908   intptr_t ld_off = 0;
 909   AllocateNode* ld_alloc = AllocateNode::Ideal_allocation(ld_adr, phase, ld_off);
 910   Node* ac = find_previous_arraycopy(phase, ld_alloc, st, true);
 911   if (ac != NULL) {
 912     assert(ac->is_ArrayCopy(), "what kind of node can this be?");
 913 
 914     Node* mem = ac->in(TypeFunc::Memory);
 915     Node* ctl = ac->in(0);
 916     Node* src = ac->in(ArrayCopyNode::Src);
 917 
 918     if (!ac->as_ArrayCopy()->is_clonebasic() && !phase->type(src)->isa_aryptr()) {
 919       return NULL;
 920     }
 921 
 922     LoadNode* ld = clone()->as_Load();
 923     Node* addp = in(MemNode::Address)->clone();
 924     if (ac->as_ArrayCopy()->is_clonebasic()) {
 925       assert(ld_alloc != NULL, "need an alloc");
 926       assert(addp->is_AddP(), "address must be addp");
 927       assert(ac->in(ArrayCopyNode::Dest)->is_AddP(), "dest must be an address");
 928       BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
 929       assert(bs->step_over_gc_barrier(addp->in(AddPNode::Base)) == bs->step_over_gc_barrier(ac->in(ArrayCopyNode::Dest)->in(AddPNode::Base)), "strange pattern");
 930       assert(bs->step_over_gc_barrier(addp->in(AddPNode::Address)) == bs->step_over_gc_barrier(ac->in(ArrayCopyNode::Dest)->in(AddPNode::Address)), "strange pattern");
 931       addp->set_req(AddPNode::Base, src->in(AddPNode::Base));
 932       addp->set_req(AddPNode::Address, src->in(AddPNode::Address));
 933     } else {
 934       assert(ac->as_ArrayCopy()->is_arraycopy_validated() ||
 935              ac->as_ArrayCopy()->is_copyof_validated() ||
 936              ac->as_ArrayCopy()->is_copyofrange_validated(), "only supported cases");
 937       assert(addp->in(AddPNode::Base) == addp->in(AddPNode::Address), "should be");
 938       addp->set_req(AddPNode::Base, src);
 939       addp->set_req(AddPNode::Address, src);
 940 
 941       const TypeAryPtr* ary_t = phase->type(in(MemNode::Address))->isa_aryptr();
 942       BasicType ary_elem  = ary_t->klass()->as_array_klass()->element_type()->basic_type();
 943       uint header = arrayOopDesc::base_offset_in_bytes(ary_elem);
 944       uint shift  = exact_log2(type2aelembytes(ary_elem));
 945 
 946       Node* diff = phase->transform(new SubINode(ac->in(ArrayCopyNode::SrcPos), ac->in(ArrayCopyNode::DestPos)));
 947 #ifdef _LP64
 948       diff = phase->transform(new ConvI2LNode(diff));
 949 #endif
 950       diff = phase->transform(new LShiftXNode(diff, phase->intcon(shift)));


1066     }
1067 
1068     // A load from an initialization barrier can match a captured store.
1069     if (st->is_Proj() && st->in(0)->is_Initialize()) {
1070       InitializeNode* init = st->in(0)->as_Initialize();
1071       AllocateNode* alloc = init->allocation();
1072       if ((alloc != NULL) && (alloc == ld_alloc)) {
1073         // examine a captured store value
1074         st = init->find_captured_store(ld_off, memory_size(), phase);
1075         if (st != NULL) {
1076           continue;             // take one more trip around
1077         }
1078       }
1079     }
1080 
1081     // Load boxed value from result of valueOf() call is input parameter.
1082     if (this->is_Load() && ld_adr->is_AddP() &&
1083         (tp != NULL) && tp->is_ptr_to_boxed_value()) {
1084       intptr_t ignore = 0;
1085       Node* base = AddPNode::Ideal_base_and_offset(ld_adr, phase, ignore);
1086       BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
1087       base = bs->step_over_gc_barrier(base);
1088       if (base != NULL && base->is_Proj() &&
1089           base->as_Proj()->_con == TypeFunc::Parms &&
1090           base->in(0)->is_CallStaticJava() &&
1091           base->in(0)->as_CallStaticJava()->is_boxing_method()) {
1092         return base->in(0)->in(TypeFunc::Parms);
1093       }
1094     }
1095 
1096     break;
1097   }
1098 
1099   return NULL;
1100 }
1101 
1102 //----------------------is_instance_field_load_with_local_phi------------------
1103 bool LoadNode::is_instance_field_load_with_local_phi(Node* ctrl) {
1104   if( in(Memory)->is_Phi() && in(Memory)->in(0) == ctrl &&
1105       in(Address)->is_AddP() ) {
1106     const TypeOopPtr* t_oop = in(Address)->bottom_type()->isa_oopptr();
1107     // Only instances and boxed values.


< prev index next >