< prev index next >

src/cpu/sparc/vm/copy_sparc.hpp

Print this page




  97   }
  98 }
  99 
 100 static void pd_conjoint_jints_atomic(jint* from, jint* to, size_t count) {
 101   if (from > to) {
 102     while (count-- > 0) {
 103       // Copy forwards
 104       *to++ = *from++;
 105     }
 106   } else {
 107     from += count - 1;
 108     to   += count - 1;
 109     while (count-- > 0) {
 110       // Copy backwards
 111       *to-- = *from--;
 112     }
 113   }
 114 }
 115 
 116 static void pd_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) {
 117 #ifdef _LP64
 118   assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size");
 119   pd_conjoint_oops_atomic((oop*)from, (oop*)to, count);
 120 #else
 121   // Guarantee use of ldd/std via some asm code, because compiler won't.
 122   // See solaris_sparc.il.
 123   _Copy_conjoint_jlongs_atomic(from, to, count);
 124 #endif
 125 }
 126 
 127 static void pd_conjoint_oops_atomic(oop* from, oop* to, size_t count) {
 128   // Do better than this: inline memmove body  NEEDS CLEANUP
 129   if (from > to) {
 130     while (count-- > 0) {
 131       // Copy forwards
 132       *to++ = *from++;
 133     }
 134   } else {
 135     from += count - 1;
 136     to   += count - 1;
 137     while (count-- > 0) {
 138       // Copy backwards
 139       *to-- = *from--;
 140     }
 141   }
 142 }
 143 
 144 static void pd_arrayof_conjoint_bytes(HeapWord* from, HeapWord* to, size_t count) {
 145   pd_conjoint_bytes_atomic(from, to, count);
 146 }
 147 
 148 static void pd_arrayof_conjoint_jshorts(HeapWord* from, HeapWord* to, size_t count) {
 149   pd_conjoint_jshorts_atomic((jshort*)from, (jshort*)to, count);
 150 }
 151 
 152 static void pd_arrayof_conjoint_jints(HeapWord* from, HeapWord* to, size_t count) {
 153   pd_conjoint_jints_atomic((jint*)from, (jint*)to, count);
 154 }
 155 
 156 static void pd_arrayof_conjoint_jlongs(HeapWord* from, HeapWord* to, size_t count) {
 157   pd_conjoint_jlongs_atomic((jlong*)from, (jlong*)to, count);
 158 }
 159 
 160 static void pd_arrayof_conjoint_oops(HeapWord* from, HeapWord* to, size_t count) {
 161   pd_conjoint_oops_atomic((oop*)from, (oop*)to, count);
 162 }
 163 
 164 static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) {
 165 #ifdef _LP64
 166   guarantee(mask_bits((uintptr_t)tohw, right_n_bits(LogBytesPerLong)) == 0,
 167          "unaligned fill words");
 168   julong* to = (julong*)tohw;
 169   julong  v  = ((julong)value << 32) | value;
 170   while (count-- > 0) {
 171     *to++ = v;
 172   }
 173 #else // _LP64
 174   juint* to = (juint*)tohw;
 175   while (count-- > 0) {
 176     *to++ = value;
 177   }
 178 #endif // _LP64
 179 }
 180 
 181 typedef void (*_zero_Fn)(HeapWord* to, size_t count);
 182 
 183 // Only used for heap objects, so align_object_offset.
 184 // All other platforms pd_fill_to_aligned_words simply calls pd_fill_to_words, don't
 185 // know why this one is different.
 186 static void pd_fill_to_aligned_words(HeapWord* tohw, size_t count, juint value) {
 187   assert(MinObjAlignmentInBytes >= BytesPerLong, "need alternate implementation");
 188 
 189   if (value == 0 && UseBlockZeroing &&
 190       (count > (size_t)(BlockZeroingLowLimit >> LogHeapWordSize))) {
 191    // Call it only when block zeroing is used
 192    ((_zero_Fn)StubRoutines::zero_aligned_words())(tohw, count);
 193   } else {
 194    julong* to = (julong*)tohw;
 195    julong  v  = ((julong)value << 32) | value;
 196    // If count is odd, odd will be equal to 1 on 32-bit platform
 197    // and be equal to 0 on 64-bit platform.
 198    size_t odd = count % (BytesPerLong / HeapWordSize) ;




  97   }
  98 }
  99 
 100 static void pd_conjoint_jints_atomic(jint* from, jint* to, size_t count) {
 101   if (from > to) {
 102     while (count-- > 0) {
 103       // Copy forwards
 104       *to++ = *from++;
 105     }
 106   } else {
 107     from += count - 1;
 108     to   += count - 1;
 109     while (count-- > 0) {
 110       // Copy backwards
 111       *to-- = *from--;
 112     }
 113   }
 114 }
 115 
 116 static void pd_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) {

 117   assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size");
 118   pd_conjoint_oops_atomic((oop*)from, (oop*)to, count);





 119 }
 120 
 121 static void pd_conjoint_oops_atomic(oop* from, oop* to, size_t count) {
 122   // Do better than this: inline memmove body  NEEDS CLEANUP
 123   if (from > to) {
 124     while (count-- > 0) {
 125       // Copy forwards
 126       *to++ = *from++;
 127     }
 128   } else {
 129     from += count - 1;
 130     to   += count - 1;
 131     while (count-- > 0) {
 132       // Copy backwards
 133       *to-- = *from--;
 134     }
 135   }
 136 }
 137 
 138 static void pd_arrayof_conjoint_bytes(HeapWord* from, HeapWord* to, size_t count) {
 139   pd_conjoint_bytes_atomic(from, to, count);
 140 }
 141 
 142 static void pd_arrayof_conjoint_jshorts(HeapWord* from, HeapWord* to, size_t count) {
 143   pd_conjoint_jshorts_atomic((jshort*)from, (jshort*)to, count);
 144 }
 145 
 146 static void pd_arrayof_conjoint_jints(HeapWord* from, HeapWord* to, size_t count) {
 147   pd_conjoint_jints_atomic((jint*)from, (jint*)to, count);
 148 }
 149 
 150 static void pd_arrayof_conjoint_jlongs(HeapWord* from, HeapWord* to, size_t count) {
 151   pd_conjoint_jlongs_atomic((jlong*)from, (jlong*)to, count);
 152 }
 153 
 154 static void pd_arrayof_conjoint_oops(HeapWord* from, HeapWord* to, size_t count) {
 155   pd_conjoint_oops_atomic((oop*)from, (oop*)to, count);
 156 }
 157 
 158 static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) {

 159   guarantee(mask_bits((uintptr_t)tohw, right_n_bits(LogBytesPerLong)) == 0,
 160          "unaligned fill words");
 161   julong* to = (julong*)tohw;
 162   julong  v  = ((julong)value << 32) | value;
 163   while (count-- > 0) {
 164     *to++ = v;
 165   }






 166 }
 167 
 168 typedef void (*_zero_Fn)(HeapWord* to, size_t count);
 169 
 170 // Only used for heap objects, so align_object_offset.
 171 // All other platforms pd_fill_to_aligned_words simply calls pd_fill_to_words, don't
 172 // know why this one is different.
 173 static void pd_fill_to_aligned_words(HeapWord* tohw, size_t count, juint value) {
 174   assert(MinObjAlignmentInBytes >= BytesPerLong, "need alternate implementation");
 175 
 176   if (value == 0 && UseBlockZeroing &&
 177       (count > (size_t)(BlockZeroingLowLimit >> LogHeapWordSize))) {
 178    // Call it only when block zeroing is used
 179    ((_zero_Fn)StubRoutines::zero_aligned_words())(tohw, count);
 180   } else {
 181    julong* to = (julong*)tohw;
 182    julong  v  = ((julong)value << 32) | value;
 183    // If count is odd, odd will be equal to 1 on 32-bit platform
 184    // and be equal to 0 on 64-bit platform.
 185    size_t odd = count % (BytesPerLong / HeapWordSize) ;


< prev index next >