1 /* |
1 /* |
2 * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
1400 if (length == 0) return ac_ok; |
1400 if (length == 0) return ac_ok; |
1401 if (src->is_typeArray()) { |
1401 if (src->is_typeArray()) { |
1402 Klass* klass_oop = src->klass(); |
1402 Klass* klass_oop = src->klass(); |
1403 if (klass_oop != dst->klass()) return ac_failed; |
1403 if (klass_oop != dst->klass()) return ac_failed; |
1404 TypeArrayKlass* klass = TypeArrayKlass::cast(klass_oop); |
1404 TypeArrayKlass* klass = TypeArrayKlass::cast(klass_oop); |
1405 const int l2es = klass->log2_element_size(); |
1405 klass->copy_array(arrayOop(src), src_pos, arrayOop(dst), dst_pos, length, Thread::current()); |
1406 const int ihs = klass->array_header_in_bytes() / wordSize; |
|
1407 char* src_addr = (char*) ((oopDesc**)src + ihs) + (src_pos << l2es); |
|
1408 char* dst_addr = (char*) ((oopDesc**)dst + ihs) + (dst_pos << l2es); |
|
1409 // Potential problem: memmove is not guaranteed to be word atomic |
|
1410 // Revisit in Merlin |
|
1411 memmove(dst_addr, src_addr, length << l2es); |
|
1412 return ac_ok; |
1406 return ac_ok; |
1413 } else if (src->is_objArray() && dst->is_objArray()) { |
1407 } else if (src->is_objArray() && dst->is_objArray()) { |
1414 if (UseCompressedOops) { |
1408 if (UseCompressedOops) { |
1415 narrowOop *src_addr = objArrayOop(src)->obj_at_addr<narrowOop>(src_pos); |
1409 narrowOop *src_addr = objArrayOop(src)->obj_at_addr<narrowOop>(src_pos); |
1416 narrowOop *dst_addr = objArrayOop(dst)->obj_at_addr<narrowOop>(dst_pos); |
1410 narrowOop *dst_addr = objArrayOop(dst)->obj_at_addr<narrowOop>(dst_pos); |