< prev index next >

src/share/vm/utilities/copy.hpp

Print this page
@  rev 12742 : imported patch alpinefixes-copyswapaligned
|


 212     }
 213   }
 214 
 215   // Copy word-aligned words from lower to higher addresses, not atomic on each word
 216   inline static void conjoint_words_to_higher(HeapWord* from, HeapWord* to, size_t byte_count) {
 217     // byte_count is in bytes to check its alignment
 218     assert_params_ok(from, to, LogHeapWordSize);
 219     assert_byte_count_ok(byte_count, HeapWordSize);
 220 
 221     size_t count = (size_t)round_to(byte_count, HeapWordSize) >> LogHeapWordSize;
 222     assert(from <= to || to + count <= from, "do not overwrite source data");
 223 
 224     from += count - 1;
 225     to   += count - 1;
 226     while (count-- > 0) {
 227       *to-- = *from--;
 228     }
 229   }
 230 
 231   /**










 232    * Copy and *unconditionally* byte swap elements
 233    *
 234    * @param src address of source
 235    * @param dst address of destination
 236    * @param byte_count number of bytes to copy
 237    * @param elem_size size of the elements to copy-swap
 238    */
 239   static void conjoint_swap(address src, address dst, size_t byte_count, size_t elem_size);

















 240 
 241   // Fill methods
 242 
 243   // Fill word-aligned words, not atomic on each word
 244   // set_words
 245   static void fill_to_words(HeapWord* to, size_t count, juint value = 0) {
 246     assert_params_ok(to, LogHeapWordSize);
 247     pd_fill_to_words(to, count, value);
 248   }
 249 
 250   static void fill_to_aligned_words(HeapWord* to, size_t count, juint value = 0) {
 251     assert_params_aligned(to);
 252     pd_fill_to_aligned_words(to, count, value);
 253   }
 254 
 255   // Fill bytes
 256   static void fill_to_bytes(void* to, size_t count, jubyte value = 0) {
 257     pd_fill_to_bytes(to, count, value);
 258   }
 259 




 212     }
 213   }
 214 
 215   // Copy word-aligned words from lower to higher addresses, not atomic on each word
 216   inline static void conjoint_words_to_higher(HeapWord* from, HeapWord* to, size_t byte_count) {
 217     // byte_count is in bytes to check its alignment
 218     assert_params_ok(from, to, LogHeapWordSize);
 219     assert_byte_count_ok(byte_count, HeapWordSize);
 220 
 221     size_t count = (size_t)round_to(byte_count, HeapWordSize) >> LogHeapWordSize;
 222     assert(from <= to || to + count <= from, "do not overwrite source data");
 223 
 224     from += count - 1;
 225     to   += count - 1;
 226     while (count-- > 0) {
 227       *to-- = *from--;
 228     }
 229   }
 230 
 231   /**
 232    * Copy elements
 233    *
 234    * @param src address of source
 235    * @param dst address of destination
 236    * @param byte_count number of bytes to copy
 237    * @param elem_size size of the elements to copy-swap
 238    */
 239   static void conjoint_copy(const void* src, void* dst, size_t byte_count, size_t elem_size);
 240 
 241   /**
 242    * Copy and *unconditionally* byte swap elements
 243    *
 244    * @param src address of source
 245    * @param dst address of destination
 246    * @param byte_count number of bytes to copy
 247    * @param elem_size size of the elements to copy-swap
 248    */
 249   static void conjoint_swap(const void* src, void* dst, size_t byte_count, size_t elem_size);
 250 
 251   /**
 252    * Copy and byte swap elements from the specified endian to the native (cpu) endian if needed (if they differ)
 253    *
 254    * @param src address of source
 255    * @param dst address of destination
 256    * @param byte_count number of bytes to copy
 257    * @param elem_size size of the elements to copy-swap
 258    */
 259   template <Endian::Order endian>
 260   static void conjoint_swap_maybe(const void* src, void* dst, size_t byte_count, size_t elem_size) {
 261     if (Endian::NATIVE != endian) {
 262       conjoint_swap(src, dst, byte_count, elem_size);
 263     } else {
 264       conjoint_copy(src, dst, byte_count, elem_size);
 265     }
 266   }
 267 
 268   // Fill methods
 269 
 270   // Fill word-aligned words, not atomic on each word
 271   // set_words
 272   static void fill_to_words(HeapWord* to, size_t count, juint value = 0) {
 273     assert_params_ok(to, LogHeapWordSize);
 274     pd_fill_to_words(to, count, value);
 275   }
 276 
 277   static void fill_to_aligned_words(HeapWord* to, size_t count, juint value = 0) {
 278     assert_params_aligned(to);
 279     pd_fill_to_aligned_words(to, count, value);
 280   }
 281 
 282   // Fill bytes
 283   static void fill_to_bytes(void* to, size_t count, jubyte value = 0) {
 284     pd_fill_to_bytes(to, count, value);
 285   }
 286 


< prev index next >