hotspot/src/cpu/sparc/vm/memset_with_concurrent_readers_sparc.cpp
changeset 46619 a3919f5e8d2b
parent 34653 3c3efc6243a8
child 46625 edefffab74e2
equal deleted inserted replaced
46618:d503911aa948 46619:a3919f5e8d2b
    84 void memset_with_concurrent_readers(void* to, int value, size_t size) {
    84 void memset_with_concurrent_readers(void* to, int value, size_t size) {
    85   Prefetch::write(to, 0);
    85   Prefetch::write(to, 0);
    86   void* end = static_cast<char*>(to) + size;
    86   void* end = static_cast<char*>(to) + size;
    87   if (size >= (size_t)BytesPerWord) {
    87   if (size >= (size_t)BytesPerWord) {
    88     // Fill any partial word prefix.
    88     // Fill any partial word prefix.
    89     uintx* aligned_to = static_cast<uintx*>(align_ptr_up(to, BytesPerWord));
    89     uintx* aligned_to = static_cast<uintx*>(align_up(to, BytesPerWord));
    90     fill_subword(to, aligned_to, value);
    90     fill_subword(to, aligned_to, value);
    91 
    91 
    92     // Compute fill word.
    92     // Compute fill word.
    93     STATIC_ASSERT(BitsPerByte == 8);
    93     STATIC_ASSERT(BitsPerByte == 8);
    94     STATIC_ASSERT(BitsPerWord == 64);
    94     STATIC_ASSERT(BitsPerWord == 64);
    95     uintx xvalue = value & 0xff;
    95     uintx xvalue = value & 0xff;
    96     xvalue |= (xvalue << 8);
    96     xvalue |= (xvalue << 8);
    97     xvalue |= (xvalue << 16);
    97     xvalue |= (xvalue << 16);
    98     xvalue |= (xvalue << 32);
    98     xvalue |= (xvalue << 32);
    99 
    99 
   100     uintx* aligned_end = static_cast<uintx*>(align_ptr_down(end, BytesPerWord));
   100     uintx* aligned_end = static_cast<uintx*>(align_down(end, BytesPerWord));
   101     assert(aligned_to <= aligned_end, "invariant");
   101     assert(aligned_to <= aligned_end, "invariant");
   102 
   102 
   103     // for ( ; aligned_to < aligned_end; ++aligned_to) {
   103     // for ( ; aligned_to < aligned_end; ++aligned_to) {
   104     //   *aligned_to = xvalue;
   104     //   *aligned_to = xvalue;
   105     // }
   105     // }