hotspot/src/cpu/sparc/vm/copy_sparc.hpp
author coleenp
Sat, 30 Jan 2016 11:02:29 -0500
changeset 35898 ddc274f0052f
parent 24675 8dd2c4604ff4
child 46381 020219e46c86
permissions -rw-r--r--
8145628: hotspot metadata classes shouldn't use HeapWordSize or heap related macros like align_object_size Summary: Use align_metadata_size, align_metadata_offset and is_metadata_aligned for metadata rather than align_object_size, etc. Use wordSize rather than HeapWordSize for metadata. Use align_ptr_up rather than align_pointer_up (all the related functions are ptr). Reviewed-by: hseigel, jmasa, cjplummer
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
35898
ddc274f0052f 8145628: hotspot metadata classes shouldn't use HeapWordSize or heap related macros like align_object_size
coleenp
parents: 24675
diff changeset
     2
 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5702
diff changeset
    25
#ifndef CPU_SPARC_VM_COPY_SPARC_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5702
diff changeset
    26
#define CPU_SPARC_VM_COPY_SPARC_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5702
diff changeset
    27
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
// Inline functions for memory copy and fill.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
static void pd_conjoint_words(HeapWord* from, HeapWord* to, size_t count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
  (void)memmove(to, from, count * HeapWordSize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
static void pd_disjoint_words(HeapWord* from, HeapWord* to, size_t count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  switch (count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  case 8:  to[7] = from[7];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  case 7:  to[6] = from[6];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  case 6:  to[5] = from[5];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  case 5:  to[4] = from[4];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  case 4:  to[3] = from[3];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  case 3:  to[2] = from[2];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  case 2:  to[1] = from[1];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  case 1:  to[0] = from[0];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  case 0:  break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  default: (void)memcpy(to, from, count * HeapWordSize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
           break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
static void pd_disjoint_words_atomic(HeapWord* from, HeapWord* to, size_t count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  switch (count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  case 8:  to[7] = from[7];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  case 7:  to[6] = from[6];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  case 6:  to[5] = from[5];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  case 5:  to[4] = from[4];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  case 4:  to[3] = from[3];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  case 3:  to[2] = from[2];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  case 2:  to[1] = from[1];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  case 1:  to[0] = from[0];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  case 0:  break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  default: while (count-- > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
             *to++ = *from++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
           }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
           break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
static void pd_aligned_conjoint_words(HeapWord* from, HeapWord* to, size_t count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  (void)memmove(to, from, count * HeapWordSize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
static void pd_aligned_disjoint_words(HeapWord* from, HeapWord* to, size_t count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  pd_disjoint_words(from, to, count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
static void pd_conjoint_bytes(void* from, void* to, size_t count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  (void)memmove(to, from, count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
static void pd_conjoint_bytes_atomic(void* from, void* to, size_t count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  (void)memmove(to, from, count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
static void pd_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) {
10743
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
    85
  if (from > to) {
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
    86
    while (count-- > 0) {
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
    87
      // Copy forwards
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
    88
      *to++ = *from++;
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
    89
    }
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
    90
  } else {
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
    91
    from += count - 1;
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
    92
    to   += count - 1;
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
    93
    while (count-- > 0) {
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
    94
      // Copy backwards
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
    95
      *to-- = *from--;
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
    96
    }
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
    97
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
static void pd_conjoint_jints_atomic(jint* from, jint* to, size_t count) {
10743
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
   101
  if (from > to) {
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
   102
    while (count-- > 0) {
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
   103
      // Copy forwards
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
   104
      *to++ = *from++;
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
   105
    }
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
   106
  } else {
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
   107
    from += count - 1;
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
   108
    to   += count - 1;
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
   109
    while (count-- > 0) {
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
   110
      // Copy backwards
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
   111
      *to-- = *from--;
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
   112
    }
2ee610c1fe49 7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents: 10501
diff changeset
   113
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
static void pd_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
#ifdef _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  pd_conjoint_oops_atomic((oop*)from, (oop*)to, count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  // Guarantee use of ldd/std via some asm code, because compiler won't.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  // See solaris_sparc.il.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  _Copy_conjoint_jlongs_atomic(from, to, count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
static void pd_conjoint_oops_atomic(oop* from, oop* to, size_t count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  // Do better than this: inline memmove body  NEEDS CLEANUP
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  if (from > to) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
    while (count-- > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
      // Copy forwards
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
      *to++ = *from++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    from += count - 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    to   += count - 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
    while (count-- > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
      // Copy backwards
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
      *to-- = *from--;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
static void pd_arrayof_conjoint_bytes(HeapWord* from, HeapWord* to, size_t count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  pd_conjoint_bytes_atomic(from, to, count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
static void pd_arrayof_conjoint_jshorts(HeapWord* from, HeapWord* to, size_t count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  pd_conjoint_jshorts_atomic((jshort*)from, (jshort*)to, count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
static void pd_arrayof_conjoint_jints(HeapWord* from, HeapWord* to, size_t count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  pd_conjoint_jints_atomic((jint*)from, (jint*)to, count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
static void pd_arrayof_conjoint_jlongs(HeapWord* from, HeapWord* to, size_t count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  pd_conjoint_jlongs_atomic((jlong*)from, (jlong*)to, count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
static void pd_arrayof_conjoint_oops(HeapWord* from, HeapWord* to, size_t count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  pd_conjoint_oops_atomic((oop*)from, (oop*)to, count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   165
#ifdef _LP64
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   166
  guarantee(mask_bits((uintptr_t)tohw, right_n_bits(LogBytesPerLong)) == 0,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   167
         "unaligned fill words");
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   168
  julong* to = (julong*)tohw;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   169
  julong  v  = ((julong)value << 32) | value;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   170
  while (count-- > 0) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   171
    *to++ = v;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   172
  }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   173
#else // _LP64
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   174
  juint* to = (juint*)tohw;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   175
  while (count-- > 0) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   176
    *to++ = value;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   177
  }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   178
#endif // _LP64
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
10501
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 7397
diff changeset
   181
typedef void (*_zero_Fn)(HeapWord* to, size_t count);
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 7397
diff changeset
   182
35898
ddc274f0052f 8145628: hotspot metadata classes shouldn't use HeapWordSize or heap related macros like align_object_size
coleenp
parents: 24675
diff changeset
   183
// Only used for heap objects, so align_object_offset.
ddc274f0052f 8145628: hotspot metadata classes shouldn't use HeapWordSize or heap related macros like align_object_size
coleenp
parents: 24675
diff changeset
   184
// All other platforms pd_fill_to_aligned_words simply calls pd_fill_to_words, don't
ddc274f0052f 8145628: hotspot metadata classes shouldn't use HeapWordSize or heap related macros like align_object_size
coleenp
parents: 24675
diff changeset
   185
// know why this one is different.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
static void pd_fill_to_aligned_words(HeapWord* tohw, size_t count, juint value) {
5694
1e0532a6abff 6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents: 670
diff changeset
   187
  assert(MinObjAlignmentInBytes >= BytesPerLong, "need alternate implementation");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
10501
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 7397
diff changeset
   189
  if (value == 0 && UseBlockZeroing &&
24675
8dd2c4604ff4 8043206: Fix signed vs. unsigned comparison warning in copy_sparc.hpp
mikael
parents: 10743
diff changeset
   190
      (count > (size_t)(BlockZeroingLowLimit >> LogHeapWordSize))) {
10501
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 7397
diff changeset
   191
   // Call it only when block zeroing is used
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 7397
diff changeset
   192
   ((_zero_Fn)StubRoutines::zero_aligned_words())(tohw, count);
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 7397
diff changeset
   193
  } else {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
   julong* to = (julong*)tohw;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
   julong  v  = ((julong)value << 32) | value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
   // If count is odd, odd will be equal to 1 on 32-bit platform
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
   // and be equal to 0 on 64-bit platform.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
   size_t odd = count % (BytesPerLong / HeapWordSize) ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
5694
1e0532a6abff 6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents: 670
diff changeset
   200
   size_t aligned_count = align_object_offset(count - odd) / HeapWordsPerLong;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
   julong* end = ((julong*)tohw) + aligned_count - 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
   while (to <= end) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
     DEBUG_ONLY(count -= BytesPerLong / HeapWordSize ;)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
     *to++ = v;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
   assert(count == odd, "bad bounds on loop filling to aligned words");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
   if (odd) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
     *((juint*)to) = value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
   }
10501
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 7397
diff changeset
   211
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
static void pd_fill_to_bytes(void* to, size_t count, jubyte value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  (void)memset(to, value, count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
static void pd_zero_to_words(HeapWord* tohw, size_t count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  pd_fill_to_words(tohw, count, 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
static void pd_zero_to_bytes(void* to, size_t count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  (void)memset(to, 0, count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
}
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5702
diff changeset
   225
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5702
diff changeset
   226
#endif // CPU_SPARC_VM_COPY_SPARC_HPP