src/share/vm/opto/library_call.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 7047069 Sdiff src/share/vm/opto

src/share/vm/opto/library_call.cpp

Print this page




5208 
5209   // Done.
5210   set_memory(mem, adr_type);
5211 }
5212 
5213 
5214 bool
5215 LibraryCallKit::generate_block_arraycopy(const TypePtr* adr_type,
5216                                          BasicType basic_elem_type,
5217                                          AllocateNode* alloc,
5218                                          Node* src,  Node* src_offset,
5219                                          Node* dest, Node* dest_offset,
5220                                          Node* dest_size, bool dest_uninitialized) {
5221   // See if there is an advantage from block transfer.
5222   int scale = exact_log2(type2aelembytes(basic_elem_type));
5223   if (scale >= LogBytesPerLong)
5224     return false;               // it is already a block transfer
5225 
5226   // Look at the alignment of the starting offsets.
5227   int abase = arrayOopDesc::base_offset_in_bytes(basic_elem_type);
5228   const intptr_t BIG_NEG = -128;
5229   assert(BIG_NEG + 2*abase < 0, "neg enough");
5230 
5231   intptr_t src_off  = abase + ((intptr_t) find_int_con(src_offset, -1)  << scale);
5232   intptr_t dest_off = abase + ((intptr_t) find_int_con(dest_offset, -1) << scale);
5233   if (src_off < 0 || dest_off < 0)
5234     // At present, we can only understand constants.
5235     return false;
5236 



5237   if (((src_off | dest_off) & (BytesPerLong-1)) != 0) {
5238     // Non-aligned; too bad.
5239     // One more chance:  Pick off an initial 32-bit word.
5240     // This is a common case, since abase can be odd mod 8.
5241     if (((src_off | dest_off) & (BytesPerLong-1)) == BytesPerInt &&
5242         ((src_off ^ dest_off) & (BytesPerLong-1)) == 0) {
5243       Node* sptr = basic_plus_adr(src,  src_off);
5244       Node* dptr = basic_plus_adr(dest, dest_off);
5245       Node* sval = make_load(control(), sptr, TypeInt::INT, T_INT, adr_type);
5246       store_to_memory(control(), dptr, sval, T_INT, adr_type);
5247       src_off += BytesPerInt;
5248       dest_off += BytesPerInt;
5249     } else {
5250       return false;
5251     }
5252   }
5253   assert(src_off % BytesPerLong == 0, "");
5254   assert(dest_off % BytesPerLong == 0, "");
5255 
5256   // Do this copy by giant steps.




5208 
5209   // Done.
5210   set_memory(mem, adr_type);
5211 }
5212 
5213 
5214 bool
5215 LibraryCallKit::generate_block_arraycopy(const TypePtr* adr_type,
5216                                          BasicType basic_elem_type,
5217                                          AllocateNode* alloc,
5218                                          Node* src,  Node* src_offset,
5219                                          Node* dest, Node* dest_offset,
5220                                          Node* dest_size, bool dest_uninitialized) {
5221   // See if there is an advantage from block transfer.
5222   int scale = exact_log2(type2aelembytes(basic_elem_type));
5223   if (scale >= LogBytesPerLong)
5224     return false;               // it is already a block transfer
5225 
5226   // Look at the alignment of the starting offsets.
5227   int abase = arrayOopDesc::base_offset_in_bytes(basic_elem_type);


5228 
5229   intptr_t src_off_con  = (intptr_t) find_int_con(src_offset, -1);
5230   intptr_t dest_off_con = (intptr_t) find_int_con(dest_offset, -1);
5231   if (src_off_con < 0 || dest_off_con < 0)
5232     // At present, we can only understand constants.
5233     return false;
5234 
5235   intptr_t src_off  = abase + (src_off_con  << scale);
5236   intptr_t dest_off = abase + (dest_off_con << scale);
5237 
5238   if (((src_off | dest_off) & (BytesPerLong-1)) != 0) {
5239     // Non-aligned; too bad.
5240     // One more chance:  Pick off an initial 32-bit word.
5241     // This is a common case, since abase can be odd mod 8.
5242     if (((src_off | dest_off) & (BytesPerLong-1)) == BytesPerInt &&
5243         ((src_off ^ dest_off) & (BytesPerLong-1)) == 0) {
5244       Node* sptr = basic_plus_adr(src,  src_off);
5245       Node* dptr = basic_plus_adr(dest, dest_off);
5246       Node* sval = make_load(control(), sptr, TypeInt::INT, T_INT, adr_type);
5247       store_to_memory(control(), dptr, sval, T_INT, adr_type);
5248       src_off += BytesPerInt;
5249       dest_off += BytesPerInt;
5250     } else {
5251       return false;
5252     }
5253   }
5254   assert(src_off % BytesPerLong == 0, "");
5255   assert(dest_off % BytesPerLong == 0, "");
5256 
5257   // Do this copy by giant steps.


src/share/vm/opto/library_call.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File