Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/library_call.cpp @ 3742:b2cb497dec28
7047069: Array can dynamically change size when assigned to an object field
Summary: Fix initialization of a newly-allocated array with arraycopy
Reviewed-by: never
author | kvn |
---|---|
date | Fri, 27 May 2011 12:47:48 -0700 |
parents | e6d7eed3330c |
children | a92cdbac8b9e |
comparison
equal
deleted
inserted
replaced
3741:c76c13577460 | 3742:b2cb497dec28 |
---|---|
5223 if (scale >= LogBytesPerLong) | 5223 if (scale >= LogBytesPerLong) |
5224 return false; // it is already a block transfer | 5224 return false; // it is already a block transfer |
5225 | 5225 |
5226 // Look at the alignment of the starting offsets. | 5226 // Look at the alignment of the starting offsets. |
5227 int abase = arrayOopDesc::base_offset_in_bytes(basic_elem_type); | 5227 int abase = arrayOopDesc::base_offset_in_bytes(basic_elem_type); |
5228 const intptr_t BIG_NEG = -128; | 5228 |
5229 assert(BIG_NEG + 2*abase < 0, "neg enough"); | 5229 intptr_t src_off_con = (intptr_t) find_int_con(src_offset, -1); |
5230 | 5230 intptr_t dest_off_con = (intptr_t) find_int_con(dest_offset, -1); |
5231 intptr_t src_off = abase + ((intptr_t) find_int_con(src_offset, -1) << scale); | 5231 if (src_off_con < 0 || dest_off_con < 0) |
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. | 5232 // At present, we can only understand constants. |
5235 return false; | 5233 return false; |
5234 | |
5235 intptr_t src_off = abase + (src_off_con << scale); | |
5236 intptr_t dest_off = abase + (dest_off_con << scale); | |
5236 | 5237 |
5237 if (((src_off | dest_off) & (BytesPerLong-1)) != 0) { | 5238 if (((src_off | dest_off) & (BytesPerLong-1)) != 0) { |
5238 // Non-aligned; too bad. | 5239 // Non-aligned; too bad. |
5239 // One more chance: Pick off an initial 32-bit word. | 5240 // One more chance: Pick off an initial 32-bit word. |
5240 // This is a common case, since abase can be odd mod 8. | 5241 // This is a common case, since abase can be odd mod 8. |