Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Andreas Gampe | 277ccbd | 2014-11-03 21:36:10 -0800 | [diff] [blame] | 17 | #include "java_lang_System.h" |
| 18 | |
Andreas Gampe | a14100c | 2017-04-24 15:09:56 -0700 | [diff] [blame] | 19 | #include "nativehelper/jni_macros.h" |
| 20 | |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 21 | #include "common_throws.h" |
Ian Rogers | 1d54e73 | 2013-05-02 21:10:01 -0700 | [diff] [blame] | 22 | #include "gc/accounting/card_table-inl.h" |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 23 | #include "jni_internal.h" |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 24 | #include "mirror/array.h" |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 25 | #include "mirror/class-inl.h" |
Andreas Gampe | 8cf9cb3 | 2017-07-19 09:28:38 -0700 | [diff] [blame] | 26 | #include "mirror/class.h" |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 27 | #include "mirror/object-inl.h" |
Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 28 | #include "mirror/object_array-inl.h" |
Andreas Gampe | 87583b3 | 2017-05-25 11:22:18 -0700 | [diff] [blame] | 29 | #include "native_util.h" |
Mathieu Chartier | 0795f23 | 2016-09-27 18:43:30 -0700 | [diff] [blame] | 30 | #include "scoped_fast_native_object_access-inl.h" |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 31 | |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 32 | namespace art { |
| 33 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 34 | /* |
| 35 | * We make guarantees about the atomicity of accesses to primitive variables. These guarantees |
| 36 | * also apply to elements of arrays. In particular, 8-bit, 16-bit, and 32-bit accesses must not |
| 37 | * cause "word tearing". Accesses to 64-bit array elements may be two 32-bit operations. |
| 38 | * References are never torn regardless of the number of bits used to represent them. |
| 39 | */ |
| 40 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 41 | static void ThrowArrayStoreException_NotAnArray(const char* identifier, |
| 42 | ObjPtr<mirror::Object> array) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 43 | REQUIRES_SHARED(Locks::mutator_lock_) { |
David Sehr | 709b070 | 2016-10-13 09:12:37 -0700 | [diff] [blame] | 44 | std::string actualType(mirror::Object::PrettyTypeOf(array)); |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 45 | Thread* self = Thread::Current(); |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 46 | self->ThrowNewExceptionF("Ljava/lang/ArrayStoreException;", |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 47 | "%s of type %s is not an array", identifier, actualType.c_str()); |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 48 | } |
| 49 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 50 | static void System_arraycopy(JNIEnv* env, jclass, jobject javaSrc, jint srcPos, jobject javaDst, |
| 51 | jint dstPos, jint length) { |
| 52 | // The API is defined in terms of length, but length is somewhat overloaded so we use count. |
| 53 | const jint count = length; |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 54 | ScopedFastNativeObjectAccess soa(env); |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 55 | |
| 56 | // Null pointer checks. |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 57 | if (UNLIKELY(javaSrc == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 58 | ThrowNullPointerException("src == null"); |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 59 | return; |
| 60 | } |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 61 | if (UNLIKELY(javaDst == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 62 | ThrowNullPointerException("dst == null"); |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 63 | return; |
| 64 | } |
| 65 | |
| 66 | // Make sure source and destination are both arrays. |
Mathieu Chartier | 0795f23 | 2016-09-27 18:43:30 -0700 | [diff] [blame] | 67 | ObjPtr<mirror::Object> srcObject = soa.Decode<mirror::Object>(javaSrc); |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 68 | if (UNLIKELY(!srcObject->IsArrayInstance())) { |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 69 | ThrowArrayStoreException_NotAnArray("source", srcObject); |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 70 | return; |
| 71 | } |
Mathieu Chartier | 0795f23 | 2016-09-27 18:43:30 -0700 | [diff] [blame] | 72 | ObjPtr<mirror::Object> dstObject = soa.Decode<mirror::Object>(javaDst); |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 73 | if (UNLIKELY(!dstObject->IsArrayInstance())) { |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 74 | ThrowArrayStoreException_NotAnArray("destination", dstObject); |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 75 | return; |
| 76 | } |
Mathieu Chartier | bc5a795 | 2016-10-17 15:46:31 -0700 | [diff] [blame] | 77 | ObjPtr<mirror::Array> srcArray = srcObject->AsArray(); |
| 78 | ObjPtr<mirror::Array> dstArray = dstObject->AsArray(); |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 79 | |
| 80 | // Bounds checking. |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 81 | if (UNLIKELY(srcPos < 0) || UNLIKELY(dstPos < 0) || UNLIKELY(count < 0) || |
| 82 | UNLIKELY(srcPos > srcArray->GetLength() - count) || |
| 83 | UNLIKELY(dstPos > dstArray->GetLength() - count)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 84 | soa.Self()->ThrowNewExceptionF("Ljava/lang/ArrayIndexOutOfBoundsException;", |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 85 | "src.length=%d srcPos=%d dst.length=%d dstPos=%d length=%d", |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 86 | srcArray->GetLength(), srcPos, dstArray->GetLength(), dstPos, |
| 87 | count); |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 88 | return; |
| 89 | } |
| 90 | |
Mathieu Chartier | bc5a795 | 2016-10-17 15:46:31 -0700 | [diff] [blame] | 91 | ObjPtr<mirror::Class> dstComponentType = dstArray->GetClass()->GetComponentType(); |
| 92 | ObjPtr<mirror::Class> srcComponentType = srcArray->GetClass()->GetComponentType(); |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 93 | Primitive::Type dstComponentPrimitiveType = dstComponentType->GetPrimitiveType(); |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 94 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 95 | if (LIKELY(srcComponentType == dstComponentType)) { |
| 96 | // Trivial assignability. |
| 97 | switch (dstComponentPrimitiveType) { |
| 98 | case Primitive::kPrimVoid: |
| 99 | LOG(FATAL) << "Unreachable, cannot have arrays of type void"; |
Ian Rogers | 2c4257b | 2014-10-24 14:20:06 -0700 | [diff] [blame] | 100 | UNREACHABLE(); |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 101 | case Primitive::kPrimBoolean: |
| 102 | case Primitive::kPrimByte: |
| 103 | DCHECK_EQ(Primitive::ComponentSize(dstComponentPrimitiveType), 1U); |
| 104 | dstArray->AsByteSizedArray()->Memmove(dstPos, srcArray->AsByteSizedArray(), srcPos, count); |
| 105 | return; |
| 106 | case Primitive::kPrimChar: |
| 107 | case Primitive::kPrimShort: |
| 108 | DCHECK_EQ(Primitive::ComponentSize(dstComponentPrimitiveType), 2U); |
| 109 | dstArray->AsShortSizedArray()->Memmove(dstPos, srcArray->AsShortSizedArray(), srcPos, count); |
| 110 | return; |
| 111 | case Primitive::kPrimInt: |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 112 | DCHECK_EQ(Primitive::ComponentSize(dstComponentPrimitiveType), 4U); |
| 113 | dstArray->AsIntArray()->Memmove(dstPos, srcArray->AsIntArray(), srcPos, count); |
| 114 | return; |
Andreas Gampe | c952ac9 | 2015-07-16 17:41:25 -0700 | [diff] [blame] | 115 | case Primitive::kPrimFloat: |
| 116 | DCHECK_EQ(Primitive::ComponentSize(dstComponentPrimitiveType), 4U); |
| 117 | dstArray->AsFloatArray()->Memmove(dstPos, srcArray->AsFloatArray(), srcPos, count); |
| 118 | return; |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 119 | case Primitive::kPrimLong: |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 120 | DCHECK_EQ(Primitive::ComponentSize(dstComponentPrimitiveType), 8U); |
| 121 | dstArray->AsLongArray()->Memmove(dstPos, srcArray->AsLongArray(), srcPos, count); |
| 122 | return; |
Andreas Gampe | c952ac9 | 2015-07-16 17:41:25 -0700 | [diff] [blame] | 123 | case Primitive::kPrimDouble: |
| 124 | DCHECK_EQ(Primitive::ComponentSize(dstComponentPrimitiveType), 8U); |
| 125 | dstArray->AsDoubleArray()->Memmove(dstPos, srcArray->AsDoubleArray(), srcPos, count); |
| 126 | return; |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 127 | case Primitive::kPrimNot: { |
| 128 | mirror::ObjectArray<mirror::Object>* dstObjArray = dstArray->AsObjectArray<mirror::Object>(); |
| 129 | mirror::ObjectArray<mirror::Object>* srcObjArray = srcArray->AsObjectArray<mirror::Object>(); |
| 130 | dstObjArray->AssignableMemmove(dstPos, srcObjArray, srcPos, count); |
| 131 | return; |
Elliott Hughes | ab3530d | 2012-01-09 16:04:56 -0800 | [diff] [blame] | 132 | } |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 133 | default: |
David Sehr | 709b070 | 2016-10-13 09:12:37 -0700 | [diff] [blame] | 134 | LOG(FATAL) << "Unknown array type: " << srcArray->PrettyTypeOf(); |
Ian Rogers | 2c4257b | 2014-10-24 14:20:06 -0700 | [diff] [blame] | 135 | UNREACHABLE(); |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 136 | } |
| 137 | } |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 138 | // If one of the arrays holds a primitive type the other array must hold the exact same type. |
| 139 | if (UNLIKELY((dstComponentPrimitiveType != Primitive::kPrimNot) || |
| 140 | srcComponentType->IsPrimitive())) { |
David Sehr | 709b070 | 2016-10-13 09:12:37 -0700 | [diff] [blame] | 141 | std::string srcType(srcArray->PrettyTypeOf()); |
| 142 | std::string dstType(dstArray->PrettyTypeOf()); |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 143 | soa.Self()->ThrowNewExceptionF("Ljava/lang/ArrayStoreException;", |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 144 | "Incompatible types: src=%s, dst=%s", |
| 145 | srcType.c_str(), dstType.c_str()); |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 146 | return; |
| 147 | } |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 148 | // Arrays hold distinct types and so therefore can't alias - use memcpy instead of memmove. |
Mathieu Chartier | bc5a795 | 2016-10-17 15:46:31 -0700 | [diff] [blame] | 149 | ObjPtr<mirror::ObjectArray<mirror::Object>> dstObjArray = |
| 150 | dstArray->AsObjectArray<mirror::Object>(); |
| 151 | ObjPtr<mirror::ObjectArray<mirror::Object>> srcObjArray = |
| 152 | srcArray->AsObjectArray<mirror::Object>(); |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 153 | // If we're assigning into say Object[] then we don't need per element checks. |
| 154 | if (dstComponentType->IsAssignableFrom(srcComponentType)) { |
| 155 | dstObjArray->AssignableMemcpy(dstPos, srcObjArray, srcPos, count); |
| 156 | return; |
| 157 | } |
Andreas Gampe | 85a098a | 2016-03-31 13:30:53 -0700 | [diff] [blame] | 158 | // This code is never run under a transaction. |
| 159 | DCHECK(!Runtime::Current()->IsActiveTransaction()); |
| 160 | dstObjArray->AssignableCheckingMemcpy<false>(dstPos, srcObjArray, srcPos, count, true); |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 161 | } |
| 162 | |
Emma Meersman | d735fe4 | 2014-06-18 11:50:59 -0700 | [diff] [blame] | 163 | // Template to convert general array to that of its specific primitive type. |
| 164 | template <typename T> |
Mathieu Chartier | bc5a795 | 2016-10-17 15:46:31 -0700 | [diff] [blame] | 165 | inline ObjPtr<T> AsPrimitiveArray(ObjPtr<mirror::Array> array) |
| 166 | REQUIRES_SHARED(Locks::mutator_lock_) { |
| 167 | return ObjPtr<T>::DownCast(array); |
Emma Meersman | d735fe4 | 2014-06-18 11:50:59 -0700 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | template <typename T, Primitive::Type kPrimType> |
| 171 | inline void System_arraycopyTUnchecked(JNIEnv* env, jobject javaSrc, jint srcPos, |
| 172 | jobject javaDst, jint dstPos, jint count) { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 173 | ScopedFastNativeObjectAccess soa(env); |
Mathieu Chartier | 0795f23 | 2016-09-27 18:43:30 -0700 | [diff] [blame] | 174 | ObjPtr<mirror::Object> srcObject = soa.Decode<mirror::Object>(javaSrc); |
| 175 | ObjPtr<mirror::Object> dstObject = soa.Decode<mirror::Object>(javaDst); |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 176 | DCHECK(dstObject != nullptr); |
Mathieu Chartier | bc5a795 | 2016-10-17 15:46:31 -0700 | [diff] [blame] | 177 | ObjPtr<mirror::Array> srcArray = srcObject->AsArray(); |
| 178 | ObjPtr<mirror::Array> dstArray = dstObject->AsArray(); |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 179 | DCHECK_GE(count, 0); |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 180 | DCHECK_EQ(srcArray->GetClass(), dstArray->GetClass()); |
Emma Meersman | d735fe4 | 2014-06-18 11:50:59 -0700 | [diff] [blame] | 181 | DCHECK_EQ(srcArray->GetClass()->GetComponentType()->GetPrimitiveType(), kPrimType); |
| 182 | AsPrimitiveArray<T>(dstArray)->Memmove(dstPos, AsPrimitiveArray<T>(srcArray), srcPos, count); |
| 183 | } |
| 184 | |
Igor Murashkin | 06537f7 | 2018-02-22 15:03:05 -0800 | [diff] [blame^] | 185 | static void System_arraycopyCharUnchecked(JNIEnv* env, jclass, jcharArray javaSrc, jint srcPos, |
| 186 | jcharArray javaDst, jint dstPos, jint count) { |
Emma Meersman | d735fe4 | 2014-06-18 11:50:59 -0700 | [diff] [blame] | 187 | System_arraycopyTUnchecked<mirror::CharArray, Primitive::kPrimChar>(env, javaSrc, srcPos, |
| 188 | javaDst, dstPos, count); |
| 189 | } |
| 190 | |
Igor Murashkin | 06537f7 | 2018-02-22 15:03:05 -0800 | [diff] [blame^] | 191 | static void System_arraycopyByteUnchecked(JNIEnv* env, jclass, jbyteArray javaSrc, jint srcPos, |
| 192 | jbyteArray javaDst, jint dstPos, jint count) { |
Emma Meersman | d735fe4 | 2014-06-18 11:50:59 -0700 | [diff] [blame] | 193 | System_arraycopyTUnchecked<mirror::ByteArray, Primitive::kPrimByte>(env, javaSrc, srcPos, |
| 194 | javaDst, dstPos, count); |
| 195 | } |
| 196 | |
Igor Murashkin | 06537f7 | 2018-02-22 15:03:05 -0800 | [diff] [blame^] | 197 | static void System_arraycopyShortUnchecked(JNIEnv* env, jclass, jshortArray javaSrc, jint srcPos, |
| 198 | jshortArray javaDst, jint dstPos, jint count) { |
Emma Meersman | d735fe4 | 2014-06-18 11:50:59 -0700 | [diff] [blame] | 199 | System_arraycopyTUnchecked<mirror::ShortArray, Primitive::kPrimShort>(env, javaSrc, srcPos, |
| 200 | javaDst, dstPos, count); |
| 201 | } |
| 202 | |
Igor Murashkin | 06537f7 | 2018-02-22 15:03:05 -0800 | [diff] [blame^] | 203 | static void System_arraycopyIntUnchecked(JNIEnv* env, jclass, jintArray javaSrc, jint srcPos, |
| 204 | jintArray javaDst, jint dstPos, jint count) { |
Emma Meersman | d735fe4 | 2014-06-18 11:50:59 -0700 | [diff] [blame] | 205 | System_arraycopyTUnchecked<mirror::IntArray, Primitive::kPrimInt>(env, javaSrc, srcPos, |
| 206 | javaDst, dstPos, count); |
| 207 | } |
| 208 | |
Igor Murashkin | 06537f7 | 2018-02-22 15:03:05 -0800 | [diff] [blame^] | 209 | static void System_arraycopyLongUnchecked(JNIEnv* env, jclass, jlongArray javaSrc, jint srcPos, |
| 210 | jlongArray javaDst, jint dstPos, jint count) { |
Emma Meersman | d735fe4 | 2014-06-18 11:50:59 -0700 | [diff] [blame] | 211 | System_arraycopyTUnchecked<mirror::LongArray, Primitive::kPrimLong>(env, javaSrc, srcPos, |
| 212 | javaDst, dstPos, count); |
| 213 | } |
| 214 | |
Igor Murashkin | 06537f7 | 2018-02-22 15:03:05 -0800 | [diff] [blame^] | 215 | static void System_arraycopyFloatUnchecked(JNIEnv* env, jclass, jfloatArray javaSrc, jint srcPos, |
| 216 | jfloatArray javaDst, jint dstPos, jint count) { |
Emma Meersman | d735fe4 | 2014-06-18 11:50:59 -0700 | [diff] [blame] | 217 | System_arraycopyTUnchecked<mirror::FloatArray, Primitive::kPrimFloat>(env, javaSrc, srcPos, |
| 218 | javaDst, dstPos, count); |
| 219 | } |
| 220 | |
Igor Murashkin | 06537f7 | 2018-02-22 15:03:05 -0800 | [diff] [blame^] | 221 | static void System_arraycopyDoubleUnchecked(JNIEnv* env, jclass, jdoubleArray javaSrc, jint srcPos, |
| 222 | jdoubleArray javaDst, jint dstPos, jint count) { |
Emma Meersman | d735fe4 | 2014-06-18 11:50:59 -0700 | [diff] [blame] | 223 | System_arraycopyTUnchecked<mirror::DoubleArray, Primitive::kPrimDouble>(env, javaSrc, srcPos, |
| 224 | javaDst, dstPos, count); |
| 225 | } |
| 226 | |
Igor Murashkin | 06537f7 | 2018-02-22 15:03:05 -0800 | [diff] [blame^] | 227 | static void System_arraycopyBooleanUnchecked(JNIEnv* env, |
| 228 | jclass, |
| 229 | jbooleanArray javaSrc, |
| 230 | jint srcPos, |
| 231 | jbooleanArray javaDst, |
| 232 | jint dstPos, |
| 233 | jint count) { |
Emma Meersman | d735fe4 | 2014-06-18 11:50:59 -0700 | [diff] [blame] | 234 | System_arraycopyTUnchecked<mirror::BooleanArray, Primitive::kPrimBoolean>(env, javaSrc, srcPos, |
| 235 | javaDst, dstPos, count); |
Hiroshi Yamauchi | f38ea80 | 2013-08-27 13:04:26 -0700 | [diff] [blame] | 236 | } |
| 237 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 238 | static JNINativeMethod gMethods[] = { |
Igor Murashkin | 3b6f440 | 2017-02-16 16:13:17 -0800 | [diff] [blame] | 239 | FAST_NATIVE_METHOD(System, arraycopy, "(Ljava/lang/Object;ILjava/lang/Object;II)V"), |
| 240 | FAST_NATIVE_METHOD(System, arraycopyCharUnchecked, "([CI[CII)V"), |
| 241 | FAST_NATIVE_METHOD(System, arraycopyByteUnchecked, "([BI[BII)V"), |
| 242 | FAST_NATIVE_METHOD(System, arraycopyShortUnchecked, "([SI[SII)V"), |
| 243 | FAST_NATIVE_METHOD(System, arraycopyIntUnchecked, "([II[III)V"), |
| 244 | FAST_NATIVE_METHOD(System, arraycopyLongUnchecked, "([JI[JII)V"), |
| 245 | FAST_NATIVE_METHOD(System, arraycopyFloatUnchecked, "([FI[FII)V"), |
| 246 | FAST_NATIVE_METHOD(System, arraycopyDoubleUnchecked, "([DI[DII)V"), |
| 247 | FAST_NATIVE_METHOD(System, arraycopyBooleanUnchecked, "([ZI[ZII)V"), |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 248 | }; |
| 249 | |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 250 | void register_java_lang_System(JNIEnv* env) { |
Elliott Hughes | eac7667 | 2012-05-24 21:56:51 -0700 | [diff] [blame] | 251 | REGISTER_NATIVE_METHODS("java/lang/System"); |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 252 | } |
| 253 | |
| 254 | } // namespace art |