Fri, 27 Aug 2010 17:33:49 -0700
4809552: Optimize Arrays.fill(...)
Reviewed-by: kvn
duke@435 | 1 | /* |
trims@1907 | 2 | * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | #include "incls/_precompiled.incl" |
duke@435 | 26 | #include "incls/_stubRoutines.cpp.incl" |
duke@435 | 27 | |
duke@435 | 28 | |
duke@435 | 29 | // Implementation of StubRoutines - for a description |
duke@435 | 30 | // of how to extend it, see the header file. |
duke@435 | 31 | |
duke@435 | 32 | // Class Variables |
duke@435 | 33 | |
duke@435 | 34 | BufferBlob* StubRoutines::_code1 = NULL; |
duke@435 | 35 | BufferBlob* StubRoutines::_code2 = NULL; |
duke@435 | 36 | |
duke@435 | 37 | address StubRoutines::_call_stub_return_address = NULL; |
duke@435 | 38 | address StubRoutines::_call_stub_entry = NULL; |
duke@435 | 39 | |
duke@435 | 40 | address StubRoutines::_catch_exception_entry = NULL; |
duke@435 | 41 | address StubRoutines::_forward_exception_entry = NULL; |
duke@435 | 42 | address StubRoutines::_throw_AbstractMethodError_entry = NULL; |
dcubed@451 | 43 | address StubRoutines::_throw_IncompatibleClassChangeError_entry = NULL; |
duke@435 | 44 | address StubRoutines::_throw_ArithmeticException_entry = NULL; |
duke@435 | 45 | address StubRoutines::_throw_NullPointerException_entry = NULL; |
duke@435 | 46 | address StubRoutines::_throw_NullPointerException_at_call_entry = NULL; |
duke@435 | 47 | address StubRoutines::_throw_StackOverflowError_entry = NULL; |
duke@435 | 48 | address StubRoutines::_handler_for_unsafe_access_entry = NULL; |
duke@435 | 49 | jint StubRoutines::_verify_oop_count = 0; |
duke@435 | 50 | address StubRoutines::_verify_oop_subroutine_entry = NULL; |
duke@435 | 51 | address StubRoutines::_atomic_xchg_entry = NULL; |
duke@435 | 52 | address StubRoutines::_atomic_xchg_ptr_entry = NULL; |
duke@435 | 53 | address StubRoutines::_atomic_store_entry = NULL; |
duke@435 | 54 | address StubRoutines::_atomic_store_ptr_entry = NULL; |
duke@435 | 55 | address StubRoutines::_atomic_cmpxchg_entry = NULL; |
duke@435 | 56 | address StubRoutines::_atomic_cmpxchg_ptr_entry = NULL; |
duke@435 | 57 | address StubRoutines::_atomic_cmpxchg_long_entry = NULL; |
duke@435 | 58 | address StubRoutines::_atomic_add_entry = NULL; |
duke@435 | 59 | address StubRoutines::_atomic_add_ptr_entry = NULL; |
duke@435 | 60 | address StubRoutines::_fence_entry = NULL; |
duke@435 | 61 | address StubRoutines::_d2i_wrapper = NULL; |
duke@435 | 62 | address StubRoutines::_d2l_wrapper = NULL; |
duke@435 | 63 | |
duke@435 | 64 | jint StubRoutines::_fpu_cntrl_wrd_std = 0; |
duke@435 | 65 | jint StubRoutines::_fpu_cntrl_wrd_24 = 0; |
duke@435 | 66 | jint StubRoutines::_fpu_cntrl_wrd_64 = 0; |
duke@435 | 67 | jint StubRoutines::_fpu_cntrl_wrd_trunc = 0; |
duke@435 | 68 | jint StubRoutines::_mxcsr_std = 0; |
duke@435 | 69 | jint StubRoutines::_fpu_subnormal_bias1[3] = { 0, 0, 0 }; |
duke@435 | 70 | jint StubRoutines::_fpu_subnormal_bias2[3] = { 0, 0, 0 }; |
duke@435 | 71 | |
duke@435 | 72 | // Compiled code entry points default values |
duke@435 | 73 | // The dafault functions don't have separate disjoint versions. |
duke@435 | 74 | address StubRoutines::_jbyte_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::jbyte_copy); |
duke@435 | 75 | address StubRoutines::_jshort_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::jshort_copy); |
duke@435 | 76 | address StubRoutines::_jint_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::jint_copy); |
duke@435 | 77 | address StubRoutines::_jlong_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::jlong_copy); |
duke@435 | 78 | address StubRoutines::_oop_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::oop_copy); |
duke@435 | 79 | address StubRoutines::_jbyte_disjoint_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::jbyte_copy); |
duke@435 | 80 | address StubRoutines::_jshort_disjoint_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::jshort_copy); |
duke@435 | 81 | address StubRoutines::_jint_disjoint_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::jint_copy); |
duke@435 | 82 | address StubRoutines::_jlong_disjoint_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::jlong_copy); |
duke@435 | 83 | address StubRoutines::_oop_disjoint_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::oop_copy); |
duke@435 | 84 | |
duke@435 | 85 | address StubRoutines::_arrayof_jbyte_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_jbyte_copy); |
duke@435 | 86 | address StubRoutines::_arrayof_jshort_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_jshort_copy); |
duke@435 | 87 | address StubRoutines::_arrayof_jint_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_jint_copy); |
duke@435 | 88 | address StubRoutines::_arrayof_jlong_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_jlong_copy); |
duke@435 | 89 | address StubRoutines::_arrayof_oop_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_oop_copy); |
duke@435 | 90 | address StubRoutines::_arrayof_jbyte_disjoint_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_jbyte_copy); |
duke@435 | 91 | address StubRoutines::_arrayof_jshort_disjoint_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_jshort_copy); |
duke@435 | 92 | address StubRoutines::_arrayof_jint_disjoint_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_jint_copy); |
duke@435 | 93 | address StubRoutines::_arrayof_jlong_disjoint_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_jlong_copy); |
duke@435 | 94 | address StubRoutines::_arrayof_oop_disjoint_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_oop_copy); |
duke@435 | 95 | |
duke@435 | 96 | address StubRoutines::_checkcast_arraycopy = NULL; |
duke@435 | 97 | address StubRoutines::_unsafe_arraycopy = NULL; |
duke@435 | 98 | address StubRoutines::_generic_arraycopy = NULL; |
duke@435 | 99 | |
never@2118 | 100 | |
never@2118 | 101 | address StubRoutines::_jbyte_fill; |
never@2118 | 102 | address StubRoutines::_jshort_fill; |
never@2118 | 103 | address StubRoutines::_jint_fill; |
never@2118 | 104 | address StubRoutines::_arrayof_jbyte_fill; |
never@2118 | 105 | address StubRoutines::_arrayof_jshort_fill; |
never@2118 | 106 | address StubRoutines::_arrayof_jint_fill; |
never@2118 | 107 | |
never@2118 | 108 | |
never@1609 | 109 | double (* StubRoutines::_intrinsic_log )(double) = NULL; |
never@1609 | 110 | double (* StubRoutines::_intrinsic_log10 )(double) = NULL; |
never@1609 | 111 | double (* StubRoutines::_intrinsic_exp )(double) = NULL; |
never@1609 | 112 | double (* StubRoutines::_intrinsic_pow )(double, double) = NULL; |
never@1609 | 113 | double (* StubRoutines::_intrinsic_sin )(double) = NULL; |
never@1609 | 114 | double (* StubRoutines::_intrinsic_cos )(double) = NULL; |
never@1609 | 115 | double (* StubRoutines::_intrinsic_tan )(double) = NULL; |
never@1609 | 116 | |
duke@435 | 117 | // Initialization |
duke@435 | 118 | // |
duke@435 | 119 | // Note: to break cycle with universe initialization, stubs are generated in two phases. |
duke@435 | 120 | // The first one generates stubs needed during universe init (e.g., _handle_must_compile_first_entry). |
duke@435 | 121 | // The second phase includes all other stubs (which may depend on universe being initialized.) |
duke@435 | 122 | |
duke@435 | 123 | extern void StubGenerator_generate(CodeBuffer* code, bool all); // only interface to generators |
duke@435 | 124 | |
duke@435 | 125 | void StubRoutines::initialize1() { |
duke@435 | 126 | if (_code1 == NULL) { |
duke@435 | 127 | ResourceMark rm; |
duke@435 | 128 | TraceTime timer("StubRoutines generation 1", TraceStartupTime); |
duke@435 | 129 | _code1 = BufferBlob::create("StubRoutines (1)", code_size1); |
jcoomes@1845 | 130 | if (_code1 == NULL) { |
jcoomes@1845 | 131 | vm_exit_out_of_memory(code_size1, |
jcoomes@1845 | 132 | "CodeCache: no room for StubRoutines (1)"); |
jcoomes@1845 | 133 | } |
duke@435 | 134 | CodeBuffer buffer(_code1->instructions_begin(), _code1->instructions_size()); |
duke@435 | 135 | StubGenerator_generate(&buffer, false); |
duke@435 | 136 | } |
duke@435 | 137 | } |
duke@435 | 138 | |
duke@435 | 139 | |
duke@435 | 140 | #ifdef ASSERT |
duke@435 | 141 | typedef void (*arraycopy_fn)(address src, address dst, int count); |
duke@435 | 142 | |
duke@435 | 143 | // simple tests of generated arraycopy functions |
duke@435 | 144 | static void test_arraycopy_func(address func, int alignment) { |
duke@435 | 145 | int v = 0xcc; |
duke@435 | 146 | int v2 = 0x11; |
kvn@1958 | 147 | jlong lbuffer[8]; |
kvn@1958 | 148 | jlong lbuffer2[8]; |
kvn@1958 | 149 | address fbuffer = (address) lbuffer; |
kvn@1958 | 150 | address fbuffer2 = (address) lbuffer2; |
duke@435 | 151 | unsigned int i; |
duke@435 | 152 | for (i = 0; i < sizeof(lbuffer); i++) { |
kvn@1958 | 153 | fbuffer[i] = v; fbuffer2[i] = v2; |
duke@435 | 154 | } |
kvn@1958 | 155 | // C++ does not guarantee jlong[] array alignment to 8 bytes. |
kvn@1958 | 156 | // Use middle of array to check that memory before it is not modified. |
kvn@1958 | 157 | address buffer = (address) round_to((intptr_t)&lbuffer[4], BytesPerLong); |
kvn@1958 | 158 | address buffer2 = (address) round_to((intptr_t)&lbuffer2[4], BytesPerLong); |
duke@435 | 159 | // do an aligned copy |
duke@435 | 160 | ((arraycopy_fn)func)(buffer, buffer2, 0); |
duke@435 | 161 | for (i = 0; i < sizeof(lbuffer); i++) { |
kvn@1958 | 162 | assert(fbuffer[i] == v && fbuffer2[i] == v2, "shouldn't have copied anything"); |
duke@435 | 163 | } |
duke@435 | 164 | // adjust destination alignment |
duke@435 | 165 | ((arraycopy_fn)func)(buffer, buffer2 + alignment, 0); |
duke@435 | 166 | for (i = 0; i < sizeof(lbuffer); i++) { |
kvn@1958 | 167 | assert(fbuffer[i] == v && fbuffer2[i] == v2, "shouldn't have copied anything"); |
duke@435 | 168 | } |
duke@435 | 169 | // adjust source alignment |
duke@435 | 170 | ((arraycopy_fn)func)(buffer + alignment, buffer2, 0); |
duke@435 | 171 | for (i = 0; i < sizeof(lbuffer); i++) { |
kvn@1958 | 172 | assert(fbuffer[i] == v && fbuffer2[i] == v2, "shouldn't have copied anything"); |
duke@435 | 173 | } |
duke@435 | 174 | } |
duke@435 | 175 | #endif |
duke@435 | 176 | |
duke@435 | 177 | |
duke@435 | 178 | void StubRoutines::initialize2() { |
duke@435 | 179 | if (_code2 == NULL) { |
duke@435 | 180 | ResourceMark rm; |
duke@435 | 181 | TraceTime timer("StubRoutines generation 2", TraceStartupTime); |
duke@435 | 182 | _code2 = BufferBlob::create("StubRoutines (2)", code_size2); |
jcoomes@1845 | 183 | if (_code2 == NULL) { |
jcoomes@1845 | 184 | vm_exit_out_of_memory(code_size2, |
jcoomes@1845 | 185 | "CodeCache: no room for StubRoutines (2)"); |
jcoomes@1845 | 186 | } |
duke@435 | 187 | CodeBuffer buffer(_code2->instructions_begin(), _code2->instructions_size()); |
duke@435 | 188 | StubGenerator_generate(&buffer, true); |
duke@435 | 189 | } |
duke@435 | 190 | |
duke@435 | 191 | #ifdef ASSERT |
duke@435 | 192 | |
duke@435 | 193 | #define TEST_ARRAYCOPY(type) \ |
duke@435 | 194 | test_arraycopy_func( type##_arraycopy(), sizeof(type)); \ |
duke@435 | 195 | test_arraycopy_func( type##_disjoint_arraycopy(), sizeof(type)); \ |
duke@435 | 196 | test_arraycopy_func(arrayof_##type##_arraycopy(), sizeof(HeapWord)); \ |
duke@435 | 197 | test_arraycopy_func(arrayof_##type##_disjoint_arraycopy(), sizeof(HeapWord)) |
duke@435 | 198 | |
kvn@1958 | 199 | // Make sure all the arraycopy stubs properly handle zero count |
duke@435 | 200 | TEST_ARRAYCOPY(jbyte); |
duke@435 | 201 | TEST_ARRAYCOPY(jshort); |
duke@435 | 202 | TEST_ARRAYCOPY(jint); |
duke@435 | 203 | TEST_ARRAYCOPY(jlong); |
duke@435 | 204 | |
duke@435 | 205 | #undef TEST_ARRAYCOPY |
duke@435 | 206 | |
never@2118 | 207 | #define TEST_FILL(type) \ |
never@2118 | 208 | if (_##type##_fill != NULL) { \ |
never@2118 | 209 | union { \ |
never@2118 | 210 | double d; \ |
never@2118 | 211 | type body[96]; \ |
never@2118 | 212 | } s; \ |
never@2118 | 213 | \ |
never@2118 | 214 | int v = 32; \ |
never@2118 | 215 | for (int offset = -2; offset <= 2; offset++) { \ |
never@2118 | 216 | for (int i = 0; i < 96; i++) { \ |
never@2118 | 217 | s.body[i] = 1; \ |
never@2118 | 218 | } \ |
never@2118 | 219 | type* start = s.body + 8 + offset; \ |
never@2118 | 220 | for (int aligned = 0; aligned < 2; aligned++) { \ |
never@2118 | 221 | if (aligned) { \ |
never@2118 | 222 | if (((intptr_t)start) % HeapWordSize == 0) { \ |
never@2118 | 223 | ((void (*)(type*, int, int))StubRoutines::_arrayof_##type##_fill)(start, v, 80); \ |
never@2118 | 224 | } else { \ |
never@2118 | 225 | continue; \ |
never@2118 | 226 | } \ |
never@2118 | 227 | } else { \ |
never@2118 | 228 | ((void (*)(type*, int, int))StubRoutines::_##type##_fill)(start, v, 80); \ |
never@2118 | 229 | } \ |
never@2118 | 230 | for (int i = 0; i < 96; i++) { \ |
never@2118 | 231 | if (i < (8 + offset) || i >= (88 + offset)) { \ |
never@2118 | 232 | assert(s.body[i] == 1, "what?"); \ |
never@2118 | 233 | } else { \ |
never@2118 | 234 | assert(s.body[i] == 32, "what?"); \ |
never@2118 | 235 | } \ |
never@2118 | 236 | } \ |
never@2118 | 237 | } \ |
never@2118 | 238 | } \ |
never@2118 | 239 | } \ |
never@2118 | 240 | |
never@2118 | 241 | TEST_FILL(jbyte); |
never@2118 | 242 | TEST_FILL(jshort); |
never@2118 | 243 | TEST_FILL(jint); |
never@2118 | 244 | |
never@2118 | 245 | #undef TEST_FILL |
never@2118 | 246 | |
kvn@1958 | 247 | #define TEST_COPYRTN(type) \ |
kvn@1958 | 248 | test_arraycopy_func(CAST_FROM_FN_PTR(address, Copy::conjoint_##type##s_atomic), sizeof(type)); \ |
kvn@1958 | 249 | test_arraycopy_func(CAST_FROM_FN_PTR(address, Copy::arrayof_conjoint_##type##s), (int)MAX2(sizeof(HeapWord), sizeof(type))) |
kvn@1958 | 250 | |
kvn@1958 | 251 | // Make sure all the copy runtime routines properly handle zero count |
kvn@1958 | 252 | TEST_COPYRTN(jbyte); |
kvn@1958 | 253 | TEST_COPYRTN(jshort); |
kvn@1958 | 254 | TEST_COPYRTN(jint); |
kvn@1958 | 255 | TEST_COPYRTN(jlong); |
kvn@1958 | 256 | |
kvn@1958 | 257 | #undef TEST_COPYRTN |
kvn@1958 | 258 | |
kvn@1958 | 259 | test_arraycopy_func(CAST_FROM_FN_PTR(address, Copy::conjoint_words), sizeof(HeapWord)); |
kvn@1958 | 260 | test_arraycopy_func(CAST_FROM_FN_PTR(address, Copy::disjoint_words), sizeof(HeapWord)); |
kvn@1958 | 261 | test_arraycopy_func(CAST_FROM_FN_PTR(address, Copy::disjoint_words_atomic), sizeof(HeapWord)); |
kvn@1958 | 262 | // Aligned to BytesPerLong |
kvn@1958 | 263 | test_arraycopy_func(CAST_FROM_FN_PTR(address, Copy::aligned_conjoint_words), sizeof(jlong)); |
kvn@1958 | 264 | test_arraycopy_func(CAST_FROM_FN_PTR(address, Copy::aligned_disjoint_words), sizeof(jlong)); |
kvn@1958 | 265 | |
duke@435 | 266 | #endif |
duke@435 | 267 | } |
duke@435 | 268 | |
duke@435 | 269 | |
duke@435 | 270 | void stubRoutines_init1() { StubRoutines::initialize1(); } |
duke@435 | 271 | void stubRoutines_init2() { StubRoutines::initialize2(); } |
duke@435 | 272 | |
duke@435 | 273 | // |
duke@435 | 274 | // Default versions of arraycopy functions |
duke@435 | 275 | // |
duke@435 | 276 | |
ysr@1680 | 277 | static void gen_arraycopy_barrier_pre(oop* dest, size_t count) { |
ysr@1680 | 278 | assert(count != 0, "count should be non-zero"); |
ysr@1680 | 279 | assert(count <= (size_t)max_intx, "count too large"); |
ysr@1680 | 280 | BarrierSet* bs = Universe::heap()->barrier_set(); |
ysr@1680 | 281 | assert(bs->has_write_ref_array_pre_opt(), "Must have pre-barrier opt"); |
ysr@1680 | 282 | bs->write_ref_array_pre(dest, (int)count); |
ysr@1680 | 283 | } |
ysr@1680 | 284 | |
duke@435 | 285 | static void gen_arraycopy_barrier(oop* dest, size_t count) { |
duke@435 | 286 | assert(count != 0, "count should be non-zero"); |
duke@435 | 287 | BarrierSet* bs = Universe::heap()->barrier_set(); |
duke@435 | 288 | assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt"); |
ysr@1680 | 289 | bs->write_ref_array((HeapWord*)dest, count); |
duke@435 | 290 | } |
duke@435 | 291 | |
duke@435 | 292 | JRT_LEAF(void, StubRoutines::jbyte_copy(jbyte* src, jbyte* dest, size_t count)) |
duke@435 | 293 | #ifndef PRODUCT |
duke@435 | 294 | SharedRuntime::_jbyte_array_copy_ctr++; // Slow-path byte array copy |
duke@435 | 295 | #endif // !PRODUCT |
kvn@1958 | 296 | Copy::conjoint_jbytes_atomic(src, dest, count); |
duke@435 | 297 | JRT_END |
duke@435 | 298 | |
duke@435 | 299 | JRT_LEAF(void, StubRoutines::jshort_copy(jshort* src, jshort* dest, size_t count)) |
duke@435 | 300 | #ifndef PRODUCT |
duke@435 | 301 | SharedRuntime::_jshort_array_copy_ctr++; // Slow-path short/char array copy |
duke@435 | 302 | #endif // !PRODUCT |
duke@435 | 303 | Copy::conjoint_jshorts_atomic(src, dest, count); |
duke@435 | 304 | JRT_END |
duke@435 | 305 | |
duke@435 | 306 | JRT_LEAF(void, StubRoutines::jint_copy(jint* src, jint* dest, size_t count)) |
duke@435 | 307 | #ifndef PRODUCT |
duke@435 | 308 | SharedRuntime::_jint_array_copy_ctr++; // Slow-path int/float array copy |
duke@435 | 309 | #endif // !PRODUCT |
duke@435 | 310 | Copy::conjoint_jints_atomic(src, dest, count); |
duke@435 | 311 | JRT_END |
duke@435 | 312 | |
duke@435 | 313 | JRT_LEAF(void, StubRoutines::jlong_copy(jlong* src, jlong* dest, size_t count)) |
duke@435 | 314 | #ifndef PRODUCT |
duke@435 | 315 | SharedRuntime::_jlong_array_copy_ctr++; // Slow-path long/double array copy |
duke@435 | 316 | #endif // !PRODUCT |
duke@435 | 317 | Copy::conjoint_jlongs_atomic(src, dest, count); |
duke@435 | 318 | JRT_END |
duke@435 | 319 | |
duke@435 | 320 | JRT_LEAF(void, StubRoutines::oop_copy(oop* src, oop* dest, size_t count)) |
duke@435 | 321 | #ifndef PRODUCT |
duke@435 | 322 | SharedRuntime::_oop_array_copy_ctr++; // Slow-path oop array copy |
duke@435 | 323 | #endif // !PRODUCT |
duke@435 | 324 | assert(count != 0, "count should be non-zero"); |
ysr@1680 | 325 | gen_arraycopy_barrier_pre(dest, count); |
duke@435 | 326 | Copy::conjoint_oops_atomic(src, dest, count); |
duke@435 | 327 | gen_arraycopy_barrier(dest, count); |
duke@435 | 328 | JRT_END |
duke@435 | 329 | |
duke@435 | 330 | JRT_LEAF(void, StubRoutines::arrayof_jbyte_copy(HeapWord* src, HeapWord* dest, size_t count)) |
duke@435 | 331 | #ifndef PRODUCT |
duke@435 | 332 | SharedRuntime::_jbyte_array_copy_ctr++; // Slow-path byte array copy |
duke@435 | 333 | #endif // !PRODUCT |
kvn@1958 | 334 | Copy::arrayof_conjoint_jbytes(src, dest, count); |
duke@435 | 335 | JRT_END |
duke@435 | 336 | |
duke@435 | 337 | JRT_LEAF(void, StubRoutines::arrayof_jshort_copy(HeapWord* src, HeapWord* dest, size_t count)) |
duke@435 | 338 | #ifndef PRODUCT |
duke@435 | 339 | SharedRuntime::_jshort_array_copy_ctr++; // Slow-path short/char array copy |
duke@435 | 340 | #endif // !PRODUCT |
duke@435 | 341 | Copy::arrayof_conjoint_jshorts(src, dest, count); |
duke@435 | 342 | JRT_END |
duke@435 | 343 | |
duke@435 | 344 | JRT_LEAF(void, StubRoutines::arrayof_jint_copy(HeapWord* src, HeapWord* dest, size_t count)) |
duke@435 | 345 | #ifndef PRODUCT |
duke@435 | 346 | SharedRuntime::_jint_array_copy_ctr++; // Slow-path int/float array copy |
duke@435 | 347 | #endif // !PRODUCT |
duke@435 | 348 | Copy::arrayof_conjoint_jints(src, dest, count); |
duke@435 | 349 | JRT_END |
duke@435 | 350 | |
duke@435 | 351 | JRT_LEAF(void, StubRoutines::arrayof_jlong_copy(HeapWord* src, HeapWord* dest, size_t count)) |
duke@435 | 352 | #ifndef PRODUCT |
duke@435 | 353 | SharedRuntime::_jlong_array_copy_ctr++; // Slow-path int/float array copy |
duke@435 | 354 | #endif // !PRODUCT |
duke@435 | 355 | Copy::arrayof_conjoint_jlongs(src, dest, count); |
duke@435 | 356 | JRT_END |
duke@435 | 357 | |
duke@435 | 358 | JRT_LEAF(void, StubRoutines::arrayof_oop_copy(HeapWord* src, HeapWord* dest, size_t count)) |
duke@435 | 359 | #ifndef PRODUCT |
duke@435 | 360 | SharedRuntime::_oop_array_copy_ctr++; // Slow-path oop array copy |
duke@435 | 361 | #endif // !PRODUCT |
duke@435 | 362 | assert(count != 0, "count should be non-zero"); |
ysr@1680 | 363 | gen_arraycopy_barrier_pre((oop *) dest, count); |
duke@435 | 364 | Copy::arrayof_conjoint_oops(src, dest, count); |
duke@435 | 365 | gen_arraycopy_barrier((oop *) dest, count); |
duke@435 | 366 | JRT_END |
never@2118 | 367 | |
never@2118 | 368 | |
never@2118 | 369 | address StubRoutines::select_fill_function(BasicType t, bool aligned, const char* &name) { |
never@2118 | 370 | #define RETURN_STUB(xxx_fill) { \ |
never@2118 | 371 | name = #xxx_fill; \ |
never@2118 | 372 | return StubRoutines::xxx_fill(); } |
never@2118 | 373 | |
never@2118 | 374 | switch (t) { |
never@2118 | 375 | case T_BYTE: |
never@2118 | 376 | case T_BOOLEAN: |
never@2118 | 377 | if (!aligned) RETURN_STUB(jbyte_fill); |
never@2118 | 378 | RETURN_STUB(arrayof_jbyte_fill); |
never@2118 | 379 | case T_CHAR: |
never@2118 | 380 | case T_SHORT: |
never@2118 | 381 | if (!aligned) RETURN_STUB(jshort_fill); |
never@2118 | 382 | RETURN_STUB(arrayof_jshort_fill); |
never@2118 | 383 | case T_INT: |
never@2118 | 384 | case T_FLOAT: |
never@2118 | 385 | if (!aligned) RETURN_STUB(jint_fill); |
never@2118 | 386 | RETURN_STUB(arrayof_jint_fill); |
never@2118 | 387 | case T_DOUBLE: |
never@2118 | 388 | case T_LONG: |
never@2118 | 389 | case T_ARRAY: |
never@2118 | 390 | case T_OBJECT: |
never@2118 | 391 | case T_NARROWOOP: |
never@2118 | 392 | case T_ADDRESS: |
never@2118 | 393 | // Currently unsupported |
never@2118 | 394 | return NULL; |
never@2118 | 395 | |
never@2118 | 396 | default: |
never@2118 | 397 | ShouldNotReachHere(); |
never@2118 | 398 | return NULL; |
never@2118 | 399 | } |
never@2118 | 400 | |
never@2118 | 401 | #undef RETURN_STUB |
never@2118 | 402 | } |