2 * Copyright (C) 2011 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef ART_RUNTIME_JNI_INTERNAL_H_
18 #define ART_RUNTIME_JNI_INTERNAL_H_
22 #include "nativehelper/jni_macros.h"
24 #include "base/macros.h"
26 #define REGISTER_NATIVE_METHODS(jni_class_name) \
27 RegisterNativeMethods(env, jni_class_name, gMethods, arraysize(gMethods))
34 const JNINativeInterface* GetJniNativeInterface();
35 const JNINativeInterface* GetRuntimeShutdownNativeInterface();
37 // Similar to RegisterNatives except its passed a descriptor for a class name and failures are
39 void RegisterNativeMethods(JNIEnv* env, const char* jni_class_name, const JNINativeMethod* methods,
42 int ThrowNewException(JNIEnv* env, jclass exception_class, const char* msg, jobject cause);
47 static inline ArtField* DecodeArtField(jfieldID fid) {
48 return reinterpret_cast<ArtField*>(fid);
52 static inline jfieldID EncodeArtField(ArtField* field) {
53 return reinterpret_cast<jfieldID>(field);
57 static inline jmethodID EncodeArtMethod(ArtMethod* art_method) {
58 return reinterpret_cast<jmethodID>(art_method);
62 static inline ArtMethod* DecodeArtMethod(jmethodID method_id) {
63 return reinterpret_cast<ArtMethod*>(method_id);
69 std::ostream& operator<<(std::ostream& os, const jobjectRefType& rhs);
71 #endif // ART_RUNTIME_JNI_INTERNAL_H_