DO NOT MERGE Fix all unsafe caching to be like libcore.
This way, if a runtime is restarted within a process, we re-initialize all
the cached data.
Conflicts:
src/native/java_lang_Runtime.cc -- nativeExit lost an argument in dalvik-dev
(cherry picked from commit 7756d5473fa27ce7e6ac7c31770eef7030431da4)
Change-Id: I6184fc20c2a9ec16c4b053584a4d1c3b64452d0f
diff --git a/src/jni_internal.h b/src/jni_internal.h
index 0d97aa4..2964bba 100644
--- a/src/jni_internal.h
+++ b/src/jni_internal.h
@@ -29,6 +29,13 @@
#include <iosfwd>
#include <string>
+#ifndef NATIVE_METHOD
+#define NATIVE_METHOD(className, functionName, signature) \
+ { #functionName, signature, reinterpret_cast<void*>(className ## _ ## functionName) }
+#endif
+#define REGISTER_NATIVE_METHODS(jni_class_name) \
+ RegisterNativeMethods(env, jni_class_name, gMethods, arraysize(gMethods))
+
namespace art {
class ClassLoader;
@@ -41,7 +48,7 @@
void SetJniGlobalsMax(size_t max);
void JniAbort(const char* jni_function_name);
void* FindNativeMethod(Thread* thread);
-jclass CacheClass(JNIEnv* env, const char* jni_class_name);
+void RegisterNativeMethods(JNIEnv* env, const char* jni_class_name, const JNINativeMethod* methods, size_t method_count);
template<typename T> T Decode(JNIEnv*, jobject);
template<typename T> T AddLocalReference(JNIEnv*, const Object*);