src/share/vm/utilities/copy.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/src/share/vm/utilities/copy.hpp	Wed Jun  9 10:46:11 2010
--- new/src/share/vm/utilities/copy.hpp	Wed Jun  9 10:46:11 2010

*** 77,165 **** --- 77,168 ---- // HeapWords // Word-aligned words, conjoint, not atomic on each word static void conjoint_words(HeapWord* from, HeapWord* to, size_t count) { assert_params_ok(from, to, LogHeapWordSize); + if (count == 0) return; pd_conjoint_words(from, to, count); } // Word-aligned words, disjoint, not atomic on each word static void disjoint_words(HeapWord* from, HeapWord* to, size_t count) { assert_params_ok(from, to, LogHeapWordSize); assert_disjoint(from, to, count); + if (count == 0) return; pd_disjoint_words(from, to, count); } // Word-aligned words, disjoint, atomic on each word static void disjoint_words_atomic(HeapWord* from, HeapWord* to, size_t count) { assert_params_ok(from, to, LogHeapWordSize); assert_disjoint(from, to, count); + if (count == 0) return; pd_disjoint_words_atomic(from, to, count); } // Object-aligned words, conjoint, not atomic on each word static void aligned_conjoint_words(HeapWord* from, HeapWord* to, size_t count) { assert_params_aligned(from, to); ! assert_non_zero(count); ! if (count == 0) return; pd_aligned_conjoint_words(from, to, count); } // Object-aligned words, disjoint, not atomic on each word static void aligned_disjoint_words(HeapWord* from, HeapWord* to, size_t count) { assert_params_aligned(from, to); assert_disjoint(from, to, count); ! assert_non_zero(count); ! if (count == 0) return; pd_aligned_disjoint_words(from, to, count); } // bytes, jshorts, jints, jlongs, oops // bytes, conjoint, not atomic on each byte (not that it matters) static void conjoint_bytes(void* from, void* to, size_t count) { ! assert_non_zero(count); ! if (count == 0) return; pd_conjoint_bytes(from, to, count); } // bytes, conjoint, atomic on each byte (not that it matters) static void conjoint_bytes_atomic(void* from, void* to, size_t count) { ! assert_non_zero(count); ! if (count == 0) return; pd_conjoint_bytes(from, to, count); } // jshorts, conjoint, atomic on each jshort static void conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) { assert_params_ok(from, to, LogBytesPerShort); ! assert_non_zero(count); ! if (count == 0) return; pd_conjoint_jshorts_atomic(from, to, count); } // jints, conjoint, atomic on each jint static void conjoint_jints_atomic(jint* from, jint* to, size_t count) { assert_params_ok(from, to, LogBytesPerInt); ! assert_non_zero(count); ! if (count == 0) return; pd_conjoint_jints_atomic(from, to, count); } // jlongs, conjoint, atomic on each jlong static void conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) { assert_params_ok(from, to, LogBytesPerLong); ! assert_non_zero(count); ! if (count == 0) return; pd_conjoint_jlongs_atomic(from, to, count); } // oops, conjoint, atomic on each oop static void conjoint_oops_atomic(oop* from, oop* to, size_t count) { assert_params_ok(from, to, LogBytesPerHeapOop); ! assert_non_zero(count); ! if (count == 0) return; pd_conjoint_oops_atomic(from, to, count); } // overloaded for UseCompressedOops static void conjoint_oops_atomic(narrowOop* from, narrowOop* to, size_t count) { assert(sizeof(narrowOop) == sizeof(jint), "this cast is wrong"); assert_params_ok(from, to, LogBytesPerInt); ! assert_non_zero(count); ! if (count == 0) return; pd_conjoint_jints_atomic((jint*)from, (jint*)to, count); } // Copy a span of memory. If the span is an integral number of aligned // longs, words, or ints, copy those units atomically.
*** 167,214 **** --- 170,218 ---- // of two which divides all of from, to, and size, whichever is smaller. static void conjoint_memory_atomic(void* from, void* to, size_t size); // bytes, conjoint array, atomic on each byte (not that it matters) static void arrayof_conjoint_bytes(HeapWord* from, HeapWord* to, size_t count) { ! assert_non_zero(count); ! if (count == 0) return; pd_arrayof_conjoint_bytes(from, to, count); } // jshorts, conjoint array, atomic on each jshort static void arrayof_conjoint_jshorts(HeapWord* from, HeapWord* to, size_t count) { assert_params_ok(from, to, LogBytesPerShort); ! assert_non_zero(count); ! if (count == 0) return; pd_arrayof_conjoint_jshorts(from, to, count); } // jints, conjoint array, atomic on each jint static void arrayof_conjoint_jints(HeapWord* from, HeapWord* to, size_t count) { assert_params_ok(from, to, LogBytesPerInt); ! assert_non_zero(count); ! if (count == 0) return; pd_arrayof_conjoint_jints(from, to, count); } // jlongs, conjoint array, atomic on each jlong static void arrayof_conjoint_jlongs(HeapWord* from, HeapWord* to, size_t count) { assert_params_ok(from, to, LogBytesPerLong); ! assert_non_zero(count); ! if (count == 0) return; pd_arrayof_conjoint_jlongs(from, to, count); } // oops, conjoint array, atomic on each oop static void arrayof_conjoint_oops(HeapWord* from, HeapWord* to, size_t count) { assert_params_ok(from, to, LogBytesPerHeapOop); ! assert_non_zero(count); ! if (count == 0) return; pd_arrayof_conjoint_oops(from, to, count); } // Known overlap methods // Copy word-aligned words from higher to lower addresses, not atomic on each word inline static void conjoint_words_to_lower(HeapWord* from, HeapWord* to, size_t byte_count) { // byte_count is in bytes to check its alignment assert_params_ok(from, to, LogHeapWordSize); + if (byte_count == 0) return; assert_byte_count_ok(byte_count, HeapWordSize); size_t count = (size_t)round_to(byte_count, HeapWordSize) >> LogHeapWordSize; assert(to <= from || from + count <= to, "do not overwrite source data");
*** 219,228 **** --- 223,233 ---- // Copy word-aligned words from lower to higher addresses, not atomic on each word inline static void conjoint_words_to_higher(HeapWord* from, HeapWord* to, size_t byte_count) { // byte_count is in bytes to check its alignment assert_params_ok(from, to, LogHeapWordSize); + if (byte_count == 0) return; assert_byte_count_ok(byte_count, HeapWordSize); size_t count = (size_t)round_to(byte_count, HeapWordSize) >> LogHeapWordSize; assert(from <= to || to + count <= from, "do not overwrite source data");
*** 237,256 **** --- 242,264 ---- // Fill word-aligned words, not atomic on each word // set_words static void fill_to_words(HeapWord* to, size_t count, juint value = 0) { assert_params_ok(to, LogHeapWordSize); + if (count == 0) return; pd_fill_to_words(to, count, value); } static void fill_to_aligned_words(HeapWord* to, size_t count, juint value = 0) { assert_params_aligned(to); + if (count == 0) return; pd_fill_to_aligned_words(to, count, value); } // Fill bytes static void fill_to_bytes(void* to, size_t count, jubyte value = 0) { + if (count == 0) return; pd_fill_to_bytes(to, count, value); } // Fill a span of memory. If the span is an integral number of aligned // longs, words, or ints, store to those units atomically.
*** 261,275 **** --- 269,285 ---- // Zero-fill methods // Zero word-aligned words, not atomic on each word static void zero_to_words(HeapWord* to, size_t count) { assert_params_ok(to, LogHeapWordSize); + if (count == 0) return; pd_zero_to_words(to, count); } // Zero bytes static void zero_to_bytes(void* to, size_t count) { + if (count == 0) return; pd_zero_to_bytes(to, count); } private: static bool params_disjoint(HeapWord* from, HeapWord* to, size_t count) {
*** 316,333 **** --- 326,335 ---- #ifdef ASSERT if (mask_bits((uintptr_t)to, BytesPerLong-1) != 0) basic_fatal("not long aligned"); #endif } static void assert_non_zero(size_t count) { #ifdef ASSERT if (count == 0) { basic_fatal("count must be non-zero"); } #endif } static void assert_byte_count_ok(size_t byte_count, size_t unit_size) { #ifdef ASSERT if ((size_t)round_to(byte_count, unit_size) != byte_count) { basic_fatal("byte count must be aligned");

src/share/vm/utilities/copy.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File