< prev index next >
src/hotspot/share/c1/c1_Runtime1.cpp
Print this page
rev 49217 : 8198445: Access API for primitive/native arraycopy
Reviewed-by: pliden, eosterlund, dholmes
*** 1,7 ****
/*
! * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 1400,1416 ****
if (length == 0) return ac_ok;
if (src->is_typeArray()) {
Klass* klass_oop = src->klass();
if (klass_oop != dst->klass()) return ac_failed;
TypeArrayKlass* klass = TypeArrayKlass::cast(klass_oop);
! const int l2es = klass->log2_element_size();
! const int ihs = klass->array_header_in_bytes() / wordSize;
! char* src_addr = (char*) ((oopDesc**)src + ihs) + (src_pos << l2es);
! char* dst_addr = (char*) ((oopDesc**)dst + ihs) + (dst_pos << l2es);
! // Potential problem: memmove is not guaranteed to be word atomic
! // Revisit in Merlin
! memmove(dst_addr, src_addr, length << l2es);
return ac_ok;
} else if (src->is_objArray() && dst->is_objArray()) {
if (UseCompressedOops) {
narrowOop *src_addr = objArrayOop(src)->obj_at_addr<narrowOop>(src_pos);
narrowOop *dst_addr = objArrayOop(dst)->obj_at_addr<narrowOop>(dst_pos);
--- 1400,1410 ----
if (length == 0) return ac_ok;
if (src->is_typeArray()) {
Klass* klass_oop = src->klass();
if (klass_oop != dst->klass()) return ac_failed;
TypeArrayKlass* klass = TypeArrayKlass::cast(klass_oop);
! klass->copy_array(arrayOop(src), src_pos, arrayOop(dst), dst_pos, length, Thread::current());
return ac_ok;
} else if (src->is_objArray() && dst->is_objArray()) {
if (UseCompressedOops) {
narrowOop *src_addr = objArrayOop(src)->obj_at_addr<narrowOop>(src_pos);
narrowOop *dst_addr = objArrayOop(dst)->obj_at_addr<narrowOop>(dst_pos);
< prev index next >