From 0795f23920ee9aabf28e45c63cd592dcccf00216 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Tue, 27 Sep 2016 18:43:30 -0700 Subject: Clean up ScopedThreadStateChange to use ObjPtr Also fixed inclusion of -inl.h files in .h files by adding scoped_object_access-inl.h and scoped_fast_natvie_object_access-inl.h Changed AddLocalReference / Decode to use ObjPtr. Changed libartbenchmark to be debug to avoid linkage errors. Bug: 31113334 Test: test-art-host Change-Id: I4d2e160483a29d21e1e0e440585ed328b9811483 --- runtime/native/java_lang_String.cc | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 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 aa64b79994..b3a967d167 100644 --- a/runtime/native/java_lang_String.cc +++ b/runtime/native/java_lang_String.cc @@ -22,8 +22,8 @@ #include "mirror/object-inl.h" #include "mirror/string.h" #include "mirror/string-inl.h" -#include "scoped_fast_native_object_access.h" -#include "scoped_thread_state_change.h" +#include "scoped_fast_native_object_access-inl.h" +#include "scoped_thread_state_change-inl.h" #include "ScopedLocalRef.h" #include "verify_object-inl.h" @@ -31,7 +31,7 @@ namespace art { static jchar String_charAt(JNIEnv* env, jobject java_this, jint index) { ScopedFastNativeObjectAccess soa(env); - return soa.Decode(java_this)->CharAt(index); + return soa.Decode(java_this)->CharAt(index); } static jint String_compareTo(JNIEnv* env, jobject java_this, jobject java_rhs) { @@ -40,7 +40,8 @@ static jint String_compareTo(JNIEnv* env, jobject java_this, jobject java_rhs) { ThrowNullPointerException("rhs == null"); return -1; } else { - return soa.Decode(java_this)->CompareTo(soa.Decode(java_rhs)); + return soa.Decode(java_this)->CompareTo( + soa.Decode(java_rhs).Decode()); } } @@ -51,8 +52,8 @@ static jstring String_concat(JNIEnv* env, jobject java_this, jobject java_string return nullptr; } StackHandleScope<2> hs(soa.Self()); - Handle string_this(hs.NewHandle(soa.Decode(java_this))); - Handle string_arg(hs.NewHandle(soa.Decode(java_string_arg))); + Handle string_this(hs.NewHandle(soa.Decode(java_this))); + Handle string_arg(hs.NewHandle(soa.Decode(java_string_arg))); int32_t length_this = string_this->GetLength(); int32_t length_arg = string_arg->GetLength(); if (length_arg > 0 && length_this > 0) { @@ -67,13 +68,13 @@ static jint String_fastIndexOf(JNIEnv* env, jobject java_this, jint ch, jint sta ScopedFastNativeObjectAccess soa(env); // This method does not handle supplementary characters. They're dealt with in managed code. DCHECK_LE(ch, 0xffff); - return soa.Decode(java_this)->FastIndexOf(ch, start); + return soa.Decode(java_this)->FastIndexOf(ch, start); } static jstring String_fastSubstring(JNIEnv* env, jobject java_this, jint start, jint length) { ScopedFastNativeObjectAccess soa(env); StackHandleScope<1> hs(soa.Self()); - Handle string_this(hs.NewHandle(soa.Decode(java_this))); + Handle string_this(hs.NewHandle(soa.Decode(java_this))); gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator(); mirror::String* result = mirror::String::AllocFromString(soa.Self(), length, string_this, start, allocator_type); @@ -84,25 +85,24 @@ static void String_getCharsNoCheck(JNIEnv* env, jobject java_this, jint start, j jcharArray buffer, jint index) { ScopedFastNativeObjectAccess soa(env); StackHandleScope<1> hs(soa.Self()); - Handle char_array(hs.NewHandle(soa.Decode(buffer))); - soa.Decode(java_this)->GetChars(start, end, char_array, index); + Handle char_array(hs.NewHandle(soa.Decode(buffer))); + soa.Decode(java_this)->GetChars(start, end, char_array, index); } static jstring String_intern(JNIEnv* env, jobject java_this) { ScopedFastNativeObjectAccess soa(env); - mirror::String* s = soa.Decode(java_this); - mirror::String* result = s->Intern(); + ObjPtr result = soa.Decode(java_this)->Intern(); return soa.AddLocalReference(result); } static void String_setCharAt(JNIEnv* env, jobject java_this, jint index, jchar c) { ScopedFastNativeObjectAccess soa(env); - soa.Decode(java_this)->SetCharAt(index, c); + soa.Decode(java_this)->SetCharAt(index, c); } static jcharArray String_toCharArray(JNIEnv* env, jobject java_this) { ScopedFastNativeObjectAccess soa(env); - mirror::String* s = soa.Decode(java_this); + ObjPtr s = soa.Decode(java_this); return soa.AddLocalReference(s->ToCharArray(soa.Self())); } -- cgit v1.2.3-59-g8ed1b