Fast JNI support.
Use a modifier to signal a native method is a fast JNI method. If the
modifier is set then don't perform runnable transitions.
Change-Id: I7835b4d837bfdd1cb8e2d54b919c0d5e6cf90499
diff --git a/runtime/thread-inl.h b/runtime/thread-inl.h
index 7d28785..8449607 100644
--- a/runtime/thread-inl.h
+++ b/runtime/thread-inl.h
@@ -21,11 +21,19 @@
#include <pthread.h>
+#include "base/casts.h"
#include "base/mutex-inl.h"
#include "cutils/atomic-inline.h"
+#include "jni_internal.h"
namespace art {
+// Quickly access the current thread from a JNIEnv.
+static inline Thread* ThreadForEnv(JNIEnv* env) {
+ JNIEnvExt* full_env(down_cast<JNIEnvExt*>(env));
+ return full_env->self;
+}
+
inline Thread* Thread::Current() {
// We rely on Thread::Current returning NULL for a detached thread, so it's not obvious
// that we can replace this with a direct %fs access on x86.