comparison src/share/vm/oops/objArrayKlass.cpp @ 1091:6aa7255741f3

6906727: UseCompressedOops: some card-marking fixes related to object arrays Summary: Introduced a new write_ref_array(HeapWords* start, size_t count) method that does the requisite MemRegion range calculation so (some of the) clients of the erstwhile write_ref_array(MemRegion mr) do not need to worry. This removed all external uses of array_size(), which was also simplified and made private. Asserts were added to catch other possible issues. Further, less essential, fixes stemming from this investigation are deferred to CR 6904516 (to follow shortly in hs17). Reviewed-by: kvn, coleenp, jmasa
author ysr
date Thu, 03 Dec 2009 15:01:57 -0800
parents 494244ae0171
children 4ce7240d622c
comparison
equal deleted inserted replaced
1090:fa357420e7d2 1091:6aa7255741f3
125 // We must do a barrier to cover the partial copy. 125 // We must do a barrier to cover the partial copy.
126 const size_t pd = pointer_delta(p, dst, (size_t)heapOopSize); 126 const size_t pd = pointer_delta(p, dst, (size_t)heapOopSize);
127 // pointer delta is scaled to number of elements (length field in 127 // pointer delta is scaled to number of elements (length field in
128 // objArrayOop) which we assume is 32 bit. 128 // objArrayOop) which we assume is 32 bit.
129 assert(pd == (size_t)(int)pd, "length field overflow"); 129 assert(pd == (size_t)(int)pd, "length field overflow");
130 const size_t done_word_len = objArrayOopDesc::array_size((int)pd); 130 bs->write_ref_array((HeapWord*)dst, pd);
131 bs->write_ref_array(MemRegion((HeapWord*)dst, done_word_len));
132 THROW(vmSymbols::java_lang_ArrayStoreException()); 131 THROW(vmSymbols::java_lang_ArrayStoreException());
133 return; 132 return;
134 } 133 }
135 } 134 }
136 } 135 }
137 } 136 }
138 const size_t word_len = objArrayOopDesc::array_size(length); 137 bs->write_ref_array((HeapWord*)dst, length);
139 bs->write_ref_array(MemRegion((HeapWord*)dst, word_len));
140 } 138 }
141 139
142 void objArrayKlass::copy_array(arrayOop s, int src_pos, arrayOop d, 140 void objArrayKlass::copy_array(arrayOop s, int src_pos, arrayOop d,
143 int dst_pos, int length, TRAPS) { 141 int dst_pos, int length, TRAPS) {
144 assert(s->is_objArray(), "must be obj array"); 142 assert(s->is_objArray(), "must be obj array");