Elliott Hughes | 5ee7a8b | 2011-09-13 16:40:07 -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 "sun_misc_Unsafe.h" |
| 18 | |
Ian Rogers | 1d54e73 | 2013-05-02 21:10:01 -0700 | [diff] [blame] | 19 | #include "gc/accounting/card_table-inl.h" |
Elliott Hughes | 5ee7a8b | 2011-09-13 16:40:07 -0700 | [diff] [blame] | 20 | #include "jni_internal.h" |
Hiroshi Yamauchi | 4d2efce | 2014-02-10 16:19:09 -0800 | [diff] [blame] | 21 | #include "mirror/array.h" |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 22 | #include "mirror/object.h" |
| 23 | #include "mirror/object-inl.h" |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 24 | #include "scoped_fast_native_object_access.h" |
Elliott Hughes | 5ee7a8b | 2011-09-13 16:40:07 -0700 | [diff] [blame] | 25 | |
Elliott Hughes | 5ee7a8b | 2011-09-13 16:40:07 -0700 | [diff] [blame] | 26 | namespace art { |
| 27 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 28 | static jboolean Unsafe_compareAndSwapInt(JNIEnv* env, jobject, jobject javaObj, jlong offset, |
| 29 | jint expectedValue, jint newValue) { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 30 | ScopedFastNativeObjectAccess soa(env); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 31 | mirror::Object* obj = soa.Decode<mirror::Object*>(javaObj); |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 32 | // JNI must use non transactional mode. |
Hans Boehm | d843443 | 2014-07-11 09:56:07 -0700 | [diff] [blame] | 33 | bool success = obj->CasFieldStrongSequentiallyConsistent32<false>(MemberOffset(offset), |
| 34 | expectedValue, newValue); |
Ian Rogers | 9adbff5 | 2013-01-23 18:19:03 -0800 | [diff] [blame] | 35 | return success ? JNI_TRUE : JNI_FALSE; |
Elliott Hughes | 5ee7a8b | 2011-09-13 16:40:07 -0700 | [diff] [blame] | 36 | } |
| 37 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 38 | static jboolean Unsafe_compareAndSwapLong(JNIEnv* env, jobject, jobject javaObj, jlong offset, |
| 39 | jlong expectedValue, jlong newValue) { |
| 40 | ScopedFastNativeObjectAccess soa(env); |
| 41 | mirror::Object* obj = soa.Decode<mirror::Object*>(javaObj); |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 42 | // JNI must use non transactional mode. |
Hans Boehm | d843443 | 2014-07-11 09:56:07 -0700 | [diff] [blame] | 43 | bool success = obj->CasFieldStrongSequentiallyConsistent64<false>(MemberOffset(offset), |
| 44 | expectedValue, newValue); |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 45 | return success ? JNI_TRUE : JNI_FALSE; |
| 46 | } |
| 47 | |
| 48 | static jboolean Unsafe_compareAndSwapObject(JNIEnv* env, jobject, jobject javaObj, jlong offset, |
| 49 | jobject javaExpectedValue, jobject javaNewValue) { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 50 | ScopedFastNativeObjectAccess soa(env); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 51 | mirror::Object* obj = soa.Decode<mirror::Object*>(javaObj); |
| 52 | mirror::Object* expectedValue = soa.Decode<mirror::Object*>(javaExpectedValue); |
| 53 | mirror::Object* newValue = soa.Decode<mirror::Object*>(javaNewValue); |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 54 | // JNI must use non transactional mode. |
Hans Boehm | d843443 | 2014-07-11 09:56:07 -0700 | [diff] [blame] | 55 | bool success = obj->CasFieldStrongSequentiallyConsistentObject<false>(MemberOffset(offset), |
| 56 | expectedValue, newValue); |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 57 | return success ? JNI_TRUE : JNI_FALSE; |
Elliott Hughes | 5ee7a8b | 2011-09-13 16:40:07 -0700 | [diff] [blame] | 58 | } |
| 59 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 60 | static jint Unsafe_getInt(JNIEnv* env, jobject, jobject javaObj, jlong offset) { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 61 | ScopedFastNativeObjectAccess soa(env); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 62 | mirror::Object* obj = soa.Decode<mirror::Object*>(javaObj); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 63 | return obj->GetField32(MemberOffset(offset)); |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 64 | } |
| 65 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 66 | static jint Unsafe_getIntVolatile(JNIEnv* env, jobject, jobject javaObj, jlong offset) { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 67 | ScopedFastNativeObjectAccess soa(env); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 68 | mirror::Object* obj = soa.Decode<mirror::Object*>(javaObj); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 69 | return obj->GetField32Volatile(MemberOffset(offset)); |
Elliott Hughes | 5ee7a8b | 2011-09-13 16:40:07 -0700 | [diff] [blame] | 70 | } |
| 71 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 72 | static void Unsafe_putInt(JNIEnv* env, jobject, jobject javaObj, jlong offset, jint newValue) { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 73 | ScopedFastNativeObjectAccess soa(env); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 74 | mirror::Object* obj = soa.Decode<mirror::Object*>(javaObj); |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 75 | // JNI must use non transactional mode. |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 76 | obj->SetField32<false>(MemberOffset(offset), newValue); |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 77 | } |
| 78 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 79 | static void Unsafe_putIntVolatile(JNIEnv* env, jobject, jobject javaObj, jlong offset, |
| 80 | jint newValue) { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 81 | ScopedFastNativeObjectAccess soa(env); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 82 | mirror::Object* obj = soa.Decode<mirror::Object*>(javaObj); |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 83 | // JNI must use non transactional mode. |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 84 | obj->SetField32Volatile<false>(MemberOffset(offset), newValue); |
Elliott Hughes | 5ee7a8b | 2011-09-13 16:40:07 -0700 | [diff] [blame] | 85 | } |
| 86 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 87 | static void Unsafe_putOrderedInt(JNIEnv* env, jobject, jobject javaObj, jlong offset, |
| 88 | jint newValue) { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 89 | ScopedFastNativeObjectAccess soa(env); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 90 | mirror::Object* obj = soa.Decode<mirror::Object*>(javaObj); |
Hans Boehm | 3035961 | 2014-05-21 17:46:23 -0700 | [diff] [blame] | 91 | QuasiAtomic::ThreadFenceRelease(); |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 92 | // JNI must use non transactional mode. |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 93 | obj->SetField32<false>(MemberOffset(offset), newValue); |
Elliott Hughes | 5ee7a8b | 2011-09-13 16:40:07 -0700 | [diff] [blame] | 94 | } |
| 95 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 96 | static jlong Unsafe_getLong(JNIEnv* env, jobject, jobject javaObj, jlong offset) { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 97 | ScopedFastNativeObjectAccess soa(env); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 98 | mirror::Object* obj = soa.Decode<mirror::Object*>(javaObj); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 99 | return obj->GetField64(MemberOffset(offset)); |
Elliott Hughes | 5ee7a8b | 2011-09-13 16:40:07 -0700 | [diff] [blame] | 100 | } |
| 101 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 102 | static jlong Unsafe_getLongVolatile(JNIEnv* env, jobject, jobject javaObj, jlong offset) { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 103 | ScopedFastNativeObjectAccess soa(env); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 104 | mirror::Object* obj = soa.Decode<mirror::Object*>(javaObj); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 105 | return obj->GetField64Volatile(MemberOffset(offset)); |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 106 | } |
| 107 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 108 | static void Unsafe_putLong(JNIEnv* env, jobject, jobject javaObj, jlong offset, jlong newValue) { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 109 | ScopedFastNativeObjectAccess soa(env); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 110 | mirror::Object* obj = soa.Decode<mirror::Object*>(javaObj); |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 111 | // JNI must use non transactional mode. |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 112 | obj->SetField64<false>(MemberOffset(offset), newValue); |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 113 | } |
| 114 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 115 | static void Unsafe_putLongVolatile(JNIEnv* env, jobject, jobject javaObj, jlong offset, |
| 116 | jlong newValue) { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 117 | ScopedFastNativeObjectAccess soa(env); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 118 | mirror::Object* obj = soa.Decode<mirror::Object*>(javaObj); |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 119 | // JNI must use non transactional mode. |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 120 | obj->SetField64Volatile<false>(MemberOffset(offset), newValue); |
Elliott Hughes | 5ee7a8b | 2011-09-13 16:40:07 -0700 | [diff] [blame] | 121 | } |
| 122 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 123 | static void Unsafe_putOrderedLong(JNIEnv* env, jobject, jobject javaObj, jlong offset, |
| 124 | jlong newValue) { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 125 | ScopedFastNativeObjectAccess soa(env); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 126 | mirror::Object* obj = soa.Decode<mirror::Object*>(javaObj); |
Hans Boehm | 3035961 | 2014-05-21 17:46:23 -0700 | [diff] [blame] | 127 | QuasiAtomic::ThreadFenceRelease(); |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 128 | // JNI must use non transactional mode. |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 129 | obj->SetField64<false>(MemberOffset(offset), newValue); |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 130 | } |
| 131 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 132 | static jobject Unsafe_getObjectVolatile(JNIEnv* env, jobject, jobject javaObj, jlong offset) { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 133 | ScopedFastNativeObjectAccess soa(env); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 134 | mirror::Object* obj = soa.Decode<mirror::Object*>(javaObj); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 135 | mirror::Object* value = obj->GetFieldObjectVolatile<mirror::Object>(MemberOffset(offset)); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 136 | return soa.AddLocalReference<jobject>(value); |
Elliott Hughes | 5ee7a8b | 2011-09-13 16:40:07 -0700 | [diff] [blame] | 137 | } |
| 138 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 139 | static jobject Unsafe_getObject(JNIEnv* env, jobject, jobject javaObj, jlong offset) { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 140 | ScopedFastNativeObjectAccess soa(env); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 141 | mirror::Object* obj = soa.Decode<mirror::Object*>(javaObj); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 142 | mirror::Object* value = obj->GetFieldObject<mirror::Object>(MemberOffset(offset)); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 143 | return soa.AddLocalReference<jobject>(value); |
Elliott Hughes | 5ee7a8b | 2011-09-13 16:40:07 -0700 | [diff] [blame] | 144 | } |
| 145 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 146 | static void Unsafe_putObject(JNIEnv* env, jobject, jobject javaObj, jlong offset, |
| 147 | jobject javaNewValue) { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 148 | ScopedFastNativeObjectAccess soa(env); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 149 | mirror::Object* obj = soa.Decode<mirror::Object*>(javaObj); |
| 150 | mirror::Object* newValue = soa.Decode<mirror::Object*>(javaNewValue); |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 151 | // JNI must use non transactional mode. |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 152 | obj->SetFieldObject<false>(MemberOffset(offset), newValue); |
Elliott Hughes | 5ee7a8b | 2011-09-13 16:40:07 -0700 | [diff] [blame] | 153 | } |
| 154 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 155 | static void Unsafe_putObjectVolatile(JNIEnv* env, jobject, jobject javaObj, jlong offset, |
| 156 | jobject javaNewValue) { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 157 | ScopedFastNativeObjectAccess soa(env); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 158 | mirror::Object* obj = soa.Decode<mirror::Object*>(javaObj); |
| 159 | mirror::Object* newValue = soa.Decode<mirror::Object*>(javaNewValue); |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 160 | // JNI must use non transactional mode. |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 161 | obj->SetFieldObjectVolatile<false>(MemberOffset(offset), newValue); |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 162 | } |
| 163 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 164 | static void Unsafe_putOrderedObject(JNIEnv* env, jobject, jobject javaObj, jlong offset, |
| 165 | jobject javaNewValue) { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 166 | ScopedFastNativeObjectAccess soa(env); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 167 | mirror::Object* obj = soa.Decode<mirror::Object*>(javaObj); |
| 168 | mirror::Object* newValue = soa.Decode<mirror::Object*>(javaNewValue); |
Hans Boehm | 3035961 | 2014-05-21 17:46:23 -0700 | [diff] [blame] | 169 | QuasiAtomic::ThreadFenceRelease(); |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 170 | // JNI must use non transactional mode. |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 171 | obj->SetFieldObject<false>(MemberOffset(offset), newValue); |
Elliott Hughes | 5ee7a8b | 2011-09-13 16:40:07 -0700 | [diff] [blame] | 172 | } |
| 173 | |
Hiroshi Yamauchi | 4d2efce | 2014-02-10 16:19:09 -0800 | [diff] [blame] | 174 | static jint Unsafe_getArrayBaseOffsetForComponentType(JNIEnv* env, jclass, jobject component_class) { |
| 175 | ScopedFastNativeObjectAccess soa(env); |
| 176 | mirror::Class* component = soa.Decode<mirror::Class*>(component_class); |
| 177 | Primitive::Type primitive_type = component->GetPrimitiveType(); |
| 178 | return mirror::Array::DataOffset(Primitive::ComponentSize(primitive_type)).Int32Value(); |
| 179 | } |
| 180 | |
| 181 | static jint Unsafe_getArrayIndexScaleForComponentType(JNIEnv* env, jclass, jobject component_class) { |
| 182 | ScopedFastNativeObjectAccess soa(env); |
| 183 | mirror::Class* component = soa.Decode<mirror::Class*>(component_class); |
| 184 | Primitive::Type primitive_type = component->GetPrimitiveType(); |
| 185 | return Primitive::ComponentSize(primitive_type); |
| 186 | } |
| 187 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 188 | static JNINativeMethod gMethods[] = { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 189 | NATIVE_METHOD(Unsafe, compareAndSwapInt, "!(Ljava/lang/Object;JII)Z"), |
| 190 | NATIVE_METHOD(Unsafe, compareAndSwapLong, "!(Ljava/lang/Object;JJJ)Z"), |
| 191 | NATIVE_METHOD(Unsafe, compareAndSwapObject, "!(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z"), |
| 192 | NATIVE_METHOD(Unsafe, getIntVolatile, "!(Ljava/lang/Object;J)I"), |
| 193 | NATIVE_METHOD(Unsafe, putIntVolatile, "!(Ljava/lang/Object;JI)V"), |
| 194 | NATIVE_METHOD(Unsafe, getLongVolatile, "!(Ljava/lang/Object;J)J"), |
| 195 | NATIVE_METHOD(Unsafe, putLongVolatile, "!(Ljava/lang/Object;JJ)V"), |
| 196 | NATIVE_METHOD(Unsafe, getObjectVolatile, "!(Ljava/lang/Object;J)Ljava/lang/Object;"), |
| 197 | NATIVE_METHOD(Unsafe, putObjectVolatile, "!(Ljava/lang/Object;JLjava/lang/Object;)V"), |
| 198 | NATIVE_METHOD(Unsafe, getInt, "!(Ljava/lang/Object;J)I"), |
| 199 | NATIVE_METHOD(Unsafe, putInt, "!(Ljava/lang/Object;JI)V"), |
| 200 | NATIVE_METHOD(Unsafe, putOrderedInt, "!(Ljava/lang/Object;JI)V"), |
| 201 | NATIVE_METHOD(Unsafe, getLong, "!(Ljava/lang/Object;J)J"), |
| 202 | NATIVE_METHOD(Unsafe, putLong, "!(Ljava/lang/Object;JJ)V"), |
| 203 | NATIVE_METHOD(Unsafe, putOrderedLong, "!(Ljava/lang/Object;JJ)V"), |
| 204 | NATIVE_METHOD(Unsafe, getObject, "!(Ljava/lang/Object;J)Ljava/lang/Object;"), |
| 205 | NATIVE_METHOD(Unsafe, putObject, "!(Ljava/lang/Object;JLjava/lang/Object;)V"), |
| 206 | NATIVE_METHOD(Unsafe, putOrderedObject, "!(Ljava/lang/Object;JLjava/lang/Object;)V"), |
Hiroshi Yamauchi | 4d2efce | 2014-02-10 16:19:09 -0800 | [diff] [blame] | 207 | NATIVE_METHOD(Unsafe, getArrayBaseOffsetForComponentType, "!(Ljava/lang/Class;)I"), |
| 208 | NATIVE_METHOD(Unsafe, getArrayIndexScaleForComponentType, "!(Ljava/lang/Class;)I"), |
Elliott Hughes | 5ee7a8b | 2011-09-13 16:40:07 -0700 | [diff] [blame] | 209 | }; |
| 210 | |
Elliott Hughes | 5ee7a8b | 2011-09-13 16:40:07 -0700 | [diff] [blame] | 211 | void register_sun_misc_Unsafe(JNIEnv* env) { |
Elliott Hughes | eac7667 | 2012-05-24 21:56:51 -0700 | [diff] [blame] | 212 | REGISTER_NATIVE_METHODS("sun/misc/Unsafe"); |
Elliott Hughes | 5ee7a8b | 2011-09-13 16:40:07 -0700 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | } // namespace art |