| 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_util_concurrent_atomic_AtomicLong.h" |
| 18 | |
| Andreas Gampe | a14100c | 2017-04-24 15:09:56 -0700 | [diff] [blame] | 19 | #include "nativehelper/jni_macros.h" |
| 20 | |
| Andreas Gampe | 0866f4e | 2016-02-22 10:03:12 -0800 | [diff] [blame] | 21 | #include "arch/instruction_set.h" |
| David Sehr | c431b9d | 2018-03-02 12:01:51 -0800 | [diff] [blame] | 22 | #include "base/atomic.h" |
| 23 | #include "base/quasi_atomic.h" |
| Vladimir Marko | a3ad0cd | 2018-05-04 10:06:38 +0100 | [diff] [blame] | 24 | #include "jni/jni_internal.h" |
| Andreas Gampe | 87583b3 | 2017-05-25 11:22:18 -0700 | [diff] [blame] | 25 | #include "native_util.h" |
| Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 26 | |
| Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 27 | namespace art { |
| 28 | |
| Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 29 | static jboolean AtomicLong_VMSupportsCS8(JNIEnv*, jclass) { |
| Andreas Gampe | 0866f4e | 2016-02-22 10:03:12 -0800 | [diff] [blame] | 30 | return QuasiAtomic::LongAtomicsUseMutexes(kRuntimeISA) ? JNI_FALSE : JNI_TRUE; |
| Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 31 | } |
| 32 | |
| Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 33 | static JNINativeMethod gMethods[] = { |
| Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 34 | NATIVE_METHOD(AtomicLong, VMSupportsCS8, "()Z"), |
| 35 | }; |
| 36 | |
| Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 37 | void register_java_util_concurrent_atomic_AtomicLong(JNIEnv* env) { |
| Elliott Hughes | 7756d54 | 2012-05-24 21:56:51 -0700 | [diff] [blame] | 38 | REGISTER_NATIVE_METHODS("java/util/concurrent/atomic/AtomicLong"); |
| Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | } // namespace art |