author | coleenp |
Thu, 10 Jan 2019 15:13:51 -0500 | |
changeset 53244 | 9807daeb47c4 |
parent 53207 | b1c6d4d7f801 |
permissions | -rw-r--r-- |
53207
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
1 |
/* |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
2 |
* Copyright (c) 2019, Red Hat, Inc. All rights reserved. |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
4 |
* |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
8 |
* |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
13 |
* accompanied this code). |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
14 |
* |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
18 |
* |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
21 |
* questions. |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
22 |
*/ |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
23 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53207
diff
changeset
|
24 |
#ifndef SHARE_GC_SHARED_BARRIERSET_INLINE_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53207
diff
changeset
|
25 |
#define SHARE_GC_SHARED_BARRIERSET_INLINE_HPP |
53207
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
26 |
|
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
27 |
#include "gc/shared/barrierSet.hpp" |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
28 |
#include "oops/accessDecorators.hpp" |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
29 |
#include "oops/arrayOop.hpp" |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
30 |
#include "oops/compressedOops.inline.hpp" |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
31 |
#include "oops/objArrayOop.inline.hpp" |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
32 |
#include "oops/oop.hpp" |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
33 |
|
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
34 |
template <DecoratorSet decorators, typename BarrierSetT> |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
35 |
template <typename T> |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
36 |
inline bool BarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw, |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
37 |
arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw, |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
38 |
size_t length) { |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
39 |
T* src = arrayOopDesc::obj_offset_to_raw(src_obj, src_offset_in_bytes, src_raw); |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
40 |
T* dst = arrayOopDesc::obj_offset_to_raw(dst_obj, dst_offset_in_bytes, dst_raw); |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
41 |
|
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
42 |
if (!HasDecorator<decorators, ARRAYCOPY_CHECKCAST>::value) { |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
43 |
// Covariant, copy without checks |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
44 |
return Raw::oop_arraycopy(NULL, 0, src, NULL, 0, dst, length); |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
45 |
} |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
46 |
|
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
47 |
// Copy each element with checking casts |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
48 |
Klass* const dst_klass = objArrayOop(dst_obj)->element_klass(); |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
49 |
for (const T* const end = src + length; src < end; src++, dst++) { |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
50 |
const T elem = *src; |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
51 |
if (!oopDesc::is_instanceof_or_null(CompressedOops::decode(elem), dst_klass)) { |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
52 |
return false; |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
53 |
} |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
54 |
*dst = elem; |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
55 |
} |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
56 |
|
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
57 |
return true; |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
58 |
} |
b1c6d4d7f801
8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents:
diff
changeset
|
59 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53207
diff
changeset
|
60 |
#endif // SHARE_GC_SHARED_BARRIERSET_INLINE_HPP |