Elliott Hughes | 2faa5f1 | 2012-01-30 14:42:07 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 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 | */ |
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 16 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 17 | #ifndef ART_RUNTIME_JNI_INTERNAL_H_ |
| 18 | #define ART_RUNTIME_JNI_INTERNAL_H_ |
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 19 | |
Ian Rogers | 68d8b42 | 2014-07-17 11:09:10 -0700 | [diff] [blame] | 20 | #include <jni.h> |
Elliott Hughes | ae80b49 | 2012-04-24 10:43:17 -0700 | [diff] [blame] | 21 | #include <iosfwd> |
Elliott Hughes | 0af5543 | 2011-08-17 18:37:28 -0700 | [diff] [blame] | 22 | |
Andreas Gampe | 13b2784 | 2016-11-07 16:48:23 -0800 | [diff] [blame] | 23 | #include "base/macros.h" |
| 24 | |
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 25 | namespace art { |
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 26 | |
Andreas Gampe | 08883de | 2016-11-08 13:20:52 -0800 | [diff] [blame] | 27 | class ArtField; |
Andreas Gampe | 13b2784 | 2016-11-07 16:48:23 -0800 | [diff] [blame] | 28 | class ArtMethod; |
| 29 | |
Ian Rogers | 68d8b42 | 2014-07-17 11:09:10 -0700 | [diff] [blame] | 30 | const JNINativeInterface* GetJniNativeInterface(); |
Mathieu Chartier | 4d87df6 | 2016-01-07 15:14:19 -0800 | [diff] [blame] | 31 | const JNINativeInterface* GetRuntimeShutdownNativeInterface(); |
Ian Rogers | 68d8b42 | 2014-07-17 11:09:10 -0700 | [diff] [blame] | 32 | |
Elliott Hughes | a4f9474 | 2012-05-29 16:28:38 -0700 | [diff] [blame] | 33 | int ThrowNewException(JNIEnv* env, jclass exception_class, const char* msg, jobject cause); |
| 34 | |
Andreas Gampe | 13b2784 | 2016-11-07 16:48:23 -0800 | [diff] [blame] | 35 | namespace jni { |
| 36 | |
| 37 | ALWAYS_INLINE |
Andreas Gampe | 08883de | 2016-11-08 13:20:52 -0800 | [diff] [blame] | 38 | static inline ArtField* DecodeArtField(jfieldID fid) { |
| 39 | return reinterpret_cast<ArtField*>(fid); |
| 40 | } |
| 41 | |
| 42 | ALWAYS_INLINE |
| 43 | static inline jfieldID EncodeArtField(ArtField* field) { |
| 44 | return reinterpret_cast<jfieldID>(field); |
| 45 | } |
| 46 | |
| 47 | ALWAYS_INLINE |
Andreas Gampe | 13b2784 | 2016-11-07 16:48:23 -0800 | [diff] [blame] | 48 | static inline jmethodID EncodeArtMethod(ArtMethod* art_method) { |
| 49 | return reinterpret_cast<jmethodID>(art_method); |
| 50 | } |
| 51 | |
| 52 | ALWAYS_INLINE |
| 53 | static inline ArtMethod* DecodeArtMethod(jmethodID method_id) { |
| 54 | return reinterpret_cast<ArtMethod*>(method_id); |
| 55 | } |
| 56 | |
| 57 | } // namespace jni |
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 58 | } // namespace art |
Carl Shapiro | ea4dca8 | 2011-08-01 13:45:38 -0700 | [diff] [blame] | 59 | |
Elliott Hughes | b465ab0 | 2011-08-24 11:21:21 -0700 | [diff] [blame] | 60 | std::ostream& operator<<(std::ostream& os, const jobjectRefType& rhs); |
Ian Rogers | 68d8b42 | 2014-07-17 11:09:10 -0700 | [diff] [blame] | 61 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 62 | #endif // ART_RUNTIME_JNI_INTERNAL_H_ |