From 1eb512d33f94d1dd7ea38263307ba0f7a0dfa653 Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Fri, 18 Oct 2013 15:42:20 -0700 Subject: 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 --- runtime/native/java_lang_String.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'runtime/native/java_lang_String.cc') diff --git a/runtime/native/java_lang_String.cc b/runtime/native/java_lang_String.cc index 3e9c3f36fa..c401d502ff 100644 --- a/runtime/native/java_lang_String.cc +++ b/runtime/native/java_lang_String.cc @@ -17,13 +17,14 @@ #include "common_throws.h" #include "jni_internal.h" #include "mirror/string.h" +#include "scoped_fast_native_object_access.h" #include "scoped_thread_state_change.h" #include "ScopedLocalRef.h" namespace art { static jint String_compareTo(JNIEnv* env, jobject javaThis, jobject javaRhs) { - ScopedObjectAccess soa(env); + ScopedFastNativeObjectAccess soa(env); if (UNLIKELY(javaRhs == NULL)) { ThrowNullPointerException(NULL, "rhs == null"); return -1; @@ -33,7 +34,7 @@ static jint String_compareTo(JNIEnv* env, jobject javaThis, jobject javaRhs) { } static jint String_fastIndexOf(JNIEnv* env, jobject java_this, jint ch, jint start) { - ScopedObjectAccess soa(env); + ScopedFastNativeObjectAccess soa(env); // This method does not handle supplementary characters. They're dealt with in managed code. DCHECK_LE(ch, 0xffff); @@ -42,16 +43,16 @@ static jint String_fastIndexOf(JNIEnv* env, jobject java_this, jint ch, jint sta } static jstring String_intern(JNIEnv* env, jobject javaThis) { - ScopedObjectAccess soa(env); + ScopedFastNativeObjectAccess soa(env); mirror::String* s = soa.Decode(javaThis); mirror::String* result = s->Intern(); return soa.AddLocalReference(result); } static JNINativeMethod gMethods[] = { - NATIVE_METHOD(String, compareTo, "(Ljava/lang/String;)I"), - NATIVE_METHOD(String, fastIndexOf, "(II)I"), - NATIVE_METHOD(String, intern, "()Ljava/lang/String;"), + NATIVE_METHOD(String, compareTo, "!(Ljava/lang/String;)I"), + NATIVE_METHOD(String, fastIndexOf, "!(II)I"), + NATIVE_METHOD(String, intern, "!()Ljava/lang/String;"), }; void register_java_lang_String(JNIEnv* env) { -- cgit v1.2.3-59-g8ed1b