equal
deleted
inserted
replaced
202 inline static void conjoint_words_to_lower(HeapWord* from, HeapWord* to, size_t byte_count) { |
202 inline static void conjoint_words_to_lower(HeapWord* from, HeapWord* to, size_t byte_count) { |
203 // byte_count is in bytes to check its alignment |
203 // byte_count is in bytes to check its alignment |
204 assert_params_ok(from, to, LogHeapWordSize); |
204 assert_params_ok(from, to, LogHeapWordSize); |
205 assert_byte_count_ok(byte_count, HeapWordSize); |
205 assert_byte_count_ok(byte_count, HeapWordSize); |
206 |
206 |
207 size_t count = (size_t)round_to(byte_count, HeapWordSize) >> LogHeapWordSize; |
207 size_t count = align_up(byte_count, HeapWordSize) >> LogHeapWordSize; |
208 assert(to <= from || from + count <= to, "do not overwrite source data"); |
208 assert(to <= from || from + count <= to, "do not overwrite source data"); |
209 |
209 |
210 while (count-- > 0) { |
210 while (count-- > 0) { |
211 *to++ = *from++; |
211 *to++ = *from++; |
212 } |
212 } |
216 inline static void conjoint_words_to_higher(HeapWord* from, HeapWord* to, size_t byte_count) { |
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 |
217 // byte_count is in bytes to check its alignment |
218 assert_params_ok(from, to, LogHeapWordSize); |
218 assert_params_ok(from, to, LogHeapWordSize); |
219 assert_byte_count_ok(byte_count, HeapWordSize); |
219 assert_byte_count_ok(byte_count, HeapWordSize); |
220 |
220 |
221 size_t count = (size_t)round_to(byte_count, HeapWordSize) >> LogHeapWordSize; |
221 size_t count = align_up(byte_count, HeapWordSize) >> LogHeapWordSize; |
222 assert(from <= to || to + count <= from, "do not overwrite source data"); |
222 assert(from <= to || to + count <= from, "do not overwrite source data"); |
223 |
223 |
224 from += count - 1; |
224 from += count - 1; |
225 to += count - 1; |
225 to += count - 1; |
226 while (count-- > 0) { |
226 while (count-- > 0) { |
351 #endif |
351 #endif |
352 } |
352 } |
353 |
353 |
354 static void assert_byte_count_ok(size_t byte_count, size_t unit_size) { |
354 static void assert_byte_count_ok(size_t byte_count, size_t unit_size) { |
355 #ifdef ASSERT |
355 #ifdef ASSERT |
356 if ((size_t)round_to(byte_count, unit_size) != byte_count) { |
356 if (!is_aligned(byte_count, unit_size)) { |
357 basic_fatal("byte count must be aligned"); |
357 basic_fatal("byte count must be aligned"); |
358 } |
358 } |
359 #endif |
359 #endif |
360 } |
360 } |
361 |
361 |