hotspot/src/cpu/zero/vm/copy_zero.hpp
author twisti
Thu, 24 Oct 2013 16:23:07 -0700
changeset 21198 dd647e8d1d72
parent 7397 5b173b4ca846
permissions -rw-r--r--
8026328: Setting a breakpoint on invokedynamic crashes the JVM Reviewed-by: jrose, roland
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     1
/*
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
     2
 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     3
 * Copyright 2007 Red Hat, Inc.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     5
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     8
 * published by the Free Software Foundation.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     9
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    14
 * accompanied this code).
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    15
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    19
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4013
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4013
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4013
diff changeset
    22
 * questions.
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    23
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    24
 */
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    25
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#ifndef CPU_ZERO_VM_COPY_ZERO_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#define CPU_ZERO_VM_COPY_ZERO_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    29
// Inline functions for memory copy and fill.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    30
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    31
static void pd_conjoint_words(HeapWord* from, HeapWord* to, size_t count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    32
  memmove(to, from, count * HeapWordSize);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    33
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    34
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    35
static void pd_disjoint_words(HeapWord* from, HeapWord* to, size_t count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    36
  switch (count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    37
  case 8:  to[7] = from[7];
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    38
  case 7:  to[6] = from[6];
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    39
  case 6:  to[5] = from[5];
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    40
  case 5:  to[4] = from[4];
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    41
  case 4:  to[3] = from[3];
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    42
  case 3:  to[2] = from[2];
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    43
  case 2:  to[1] = from[1];
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    44
  case 1:  to[0] = from[0];
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    45
  case 0:  break;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    46
  default:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    47
    memcpy(to, from, count * HeapWordSize);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    48
    break;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    49
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    50
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    51
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    52
static void pd_disjoint_words_atomic(HeapWord* from,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    53
                                     HeapWord* to,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    54
                                     size_t count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    55
  switch (count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    56
  case 8:  to[7] = from[7];
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    57
  case 7:  to[6] = from[6];
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    58
  case 6:  to[5] = from[5];
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    59
  case 5:  to[4] = from[4];
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    60
  case 4:  to[3] = from[3];
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    61
  case 3:  to[2] = from[2];
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    62
  case 2:  to[1] = from[1];
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    63
  case 1:  to[0] = from[0];
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    64
  case 0:  break;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    65
  default:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    66
    while (count-- > 0) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    67
      *to++ = *from++;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    68
    }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    69
    break;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    70
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    71
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    72
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    73
static void pd_aligned_conjoint_words(HeapWord* from,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    74
                                      HeapWord* to,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    75
                                      size_t count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    76
  memmove(to, from, count * HeapWordSize);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    77
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    78
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    79
static void pd_aligned_disjoint_words(HeapWord* from,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    80
                                      HeapWord* to,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    81
                                      size_t count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    82
  pd_disjoint_words(from, to, count);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    83
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    84
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    85
static void pd_conjoint_bytes(void* from, void* to, size_t count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    86
  memmove(to, from, count);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    87
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    88
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    89
static void pd_conjoint_bytes_atomic(void* from, void* to, size_t count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    90
  memmove(to, from, count);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    91
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    92
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    93
static void pd_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    94
  _Copy_conjoint_jshorts_atomic(from, to, count);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    95
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    96
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    97
static void pd_conjoint_jints_atomic(jint* from, jint* to, size_t count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    98
  _Copy_conjoint_jints_atomic(from, to, count);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    99
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   100
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   101
static void pd_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   102
  _Copy_conjoint_jlongs_atomic(from, to, count);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   103
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   104
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   105
static void pd_conjoint_oops_atomic(oop* from, oop* to, size_t count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   106
#ifdef _LP64
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   107
  assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size");
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   108
  _Copy_conjoint_jlongs_atomic((jlong*)from, (jlong*)to, count);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   109
#else
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   110
  assert(BytesPerInt == BytesPerOop, "jints and oops must be the same size");
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   111
  _Copy_conjoint_jints_atomic((jint*)from, (jint*)to, count);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   112
#endif // _LP64
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   113
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   114
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   115
static void pd_arrayof_conjoint_bytes(HeapWord* from,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   116
                                      HeapWord* to,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   117
                                      size_t    count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   118
  _Copy_arrayof_conjoint_bytes(from, to, count);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   119
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   120
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   121
static void pd_arrayof_conjoint_jshorts(HeapWord* from,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   122
                                        HeapWord* to,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   123
                                        size_t    count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   124
  _Copy_arrayof_conjoint_jshorts(from, to, count);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   125
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   126
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   127
static void pd_arrayof_conjoint_jints(HeapWord* from,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   128
                                      HeapWord* to,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   129
                                      size_t    count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   130
  _Copy_arrayof_conjoint_jints(from, to, count);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   131
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   132
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   133
static void pd_arrayof_conjoint_jlongs(HeapWord* from,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   134
                                       HeapWord* to,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   135
                                       size_t    count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   136
  _Copy_arrayof_conjoint_jlongs(from, to, count);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   137
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   138
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   139
static void pd_arrayof_conjoint_oops(HeapWord* from,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   140
                                     HeapWord* to,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   141
                                     size_t    count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   142
#ifdef _LP64
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   143
  assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size");
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   144
  _Copy_arrayof_conjoint_jlongs(from, to, count);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   145
#else
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   146
  assert(BytesPerInt == BytesPerOop, "jints and oops must be the same size");
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   147
  _Copy_arrayof_conjoint_jints(from, to, count);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   148
#endif // _LP64
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   149
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   150
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   151
static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   152
#ifdef _LP64
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   153
  julong* to = (julong*) tohw;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   154
  julong  v  = ((julong) value << 32) | value;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   155
#else
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   156
  juint* to = (juint*) tohw;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   157
  juint  v  = value;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   158
#endif // _LP64
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   159
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   160
  while (count-- > 0) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   161
    *to++ = v;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   162
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   163
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   164
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   165
static void pd_fill_to_aligned_words(HeapWord* tohw,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   166
                                     size_t    count,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   167
                                     juint     value) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   168
  pd_fill_to_words(tohw, count, value);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   169
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   170
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   171
static void pd_fill_to_bytes(void* to, size_t count, jubyte value) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   172
  memset(to, value, count);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   173
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   174
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   175
static void pd_zero_to_words(HeapWord* tohw, size_t count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   176
  pd_fill_to_words(tohw, count, 0);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   177
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   178
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   179
static void pd_zero_to_bytes(void* to, size_t count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   180
  memset(to, 0, count);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   181
}
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   182
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   183
#endif // CPU_ZERO_VM_COPY_ZERO_HPP