• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  */
16 
17 #ifndef ART_RUNTIME_JNI_INTERNAL_H_
18 #define ART_RUNTIME_JNI_INTERNAL_H_
19 
20 #include <jni.h>
21 #include <iosfwd>
22 
23 #include "base/macros.h"
24 
25 namespace art {
26 
27 class ArtField;
28 class ArtMethod;
29 
30 const JNINativeInterface* GetJniNativeInterface();
31 const JNINativeInterface* GetRuntimeShutdownNativeInterface();
32 
33 int ThrowNewException(JNIEnv* env, jclass exception_class, const char* msg, jobject cause);
34 
35 namespace jni {
36 
37 ALWAYS_INLINE
DecodeArtField(jfieldID fid)38 static inline ArtField* DecodeArtField(jfieldID fid) {
39   return reinterpret_cast<ArtField*>(fid);
40 }
41 
42 ALWAYS_INLINE
EncodeArtField(ArtField * field)43 static inline jfieldID EncodeArtField(ArtField* field) {
44   return reinterpret_cast<jfieldID>(field);
45 }
46 
47 ALWAYS_INLINE
EncodeArtMethod(ArtMethod * art_method)48 static inline jmethodID EncodeArtMethod(ArtMethod* art_method) {
49   return reinterpret_cast<jmethodID>(art_method);
50 }
51 
52 ALWAYS_INLINE
DecodeArtMethod(jmethodID method_id)53 static inline ArtMethod* DecodeArtMethod(jmethodID method_id) {
54   return reinterpret_cast<ArtMethod*>(method_id);
55 }
56 
57 }  // namespace jni
58 }  // namespace art
59 
60 std::ostream& operator<<(std::ostream& os, const jobjectRefType& rhs);
61 
62 #endif  // ART_RUNTIME_JNI_INTERNAL_H_
63