diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-05-16 10:59:25 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-05-18 12:50:33 -0700 |
commit | f832284dd847ff077577bb5712225430bbbb3b67 (patch) | |
tree | 44f6b91098639c6ebc438b4ec998d0dc128cef9a /runtime/native | |
parent | 8f0776768712b2021aa8fb649b51017b9f0fc7a9 (diff) | |
download | art-f832284dd847ff077577bb5712225430bbbb3b67.zip art-f832284dd847ff077577bb5712225430bbbb3b67.tar.gz art-f832284dd847ff077577bb5712225430bbbb3b67.tar.bz2 |
Delete ClassHelper and fix compaction bug in GetDirectInterface
Cleanup helps to prevent compaction bugs. Fixed a fairly serious
compaction error caused by calling ClassHelper::GetDirectInterface
without handling the case where it causes thread suspension due to
ResolveType.
Bug: 8981901
Change-Id: I82b3bb6dd48d21eb6ece7aae0733c4a23c2bc408
Diffstat (limited to 'runtime/native')
-rw-r--r-- | runtime/native/dalvik_system_VMRuntime.cc | 8 | ||||
-rw-r--r-- | runtime/native/java_lang_Class.cc | 5 | ||||
-rw-r--r-- | runtime/native/java_lang_reflect_Array.cc | 2 |
3 files changed, 9 insertions, 6 deletions
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc index 8d183da..69b05f4 100644 --- a/runtime/native/dalvik_system_VMRuntime.cc +++ b/runtime/native/dalvik_system_VMRuntime.cc @@ -262,12 +262,14 @@ static void PreloadDexCachesResolveField(Handle<mirror::DexCache>& dex_cache, } const DexFile* dex_file = dex_cache->GetDexFile(); const DexFile::FieldId& field_id = dex_file->GetFieldId(field_idx); - mirror::Class* klass = dex_cache->GetResolvedType(field_id.class_idx_); - if (klass == NULL) { + Thread* const self = Thread::Current(); + StackHandleScope<1> hs(self); + Handle<mirror::Class> klass(hs.NewHandle(dex_cache->GetResolvedType(field_id.class_idx_))); + if (klass.Get() == NULL) { return; } if (is_static) { - field = klass->FindStaticField(dex_cache.Get(), field_idx); + field = mirror::Class::FindStaticField(self, klass, dex_cache.Get(), field_idx); } else { field = klass->FindInstanceField(dex_cache.Get(), field_idx); } diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc index b6cf7d8..e619dda 100644 --- a/runtime/native/java_lang_Class.cc +++ b/runtime/native/java_lang_Class.cc @@ -84,8 +84,9 @@ static jclass Class_classForName(JNIEnv* env, jclass, jstring javaName, jboolean static jstring Class_getNameNative(JNIEnv* env, jobject javaThis) { ScopedFastNativeObjectAccess soa(env); - mirror::Class* c = DecodeClass(soa, javaThis); - return soa.AddLocalReference<jstring>(c->ComputeName()); + StackHandleScope<1> hs(soa.Self()); + mirror::Class* const c = DecodeClass(soa, javaThis); + return soa.AddLocalReference<jstring>(mirror::Class::ComputeName(hs.NewHandle(c))); } static jobjectArray Class_getProxyInterfaces(JNIEnv* env, jobject javaThis) { diff --git a/runtime/native/java_lang_reflect_Array.cc b/runtime/native/java_lang_reflect_Array.cc index 7c6f2f3..db77437 100644 --- a/runtime/native/java_lang_reflect_Array.cc +++ b/runtime/native/java_lang_reflect_Array.cc @@ -35,7 +35,7 @@ static jobject Array_createMultiArray(JNIEnv* env, jclass, jclass javaElementCla DCHECK(javaDimArray != NULL); mirror::Object* dimensions_obj = soa.Decode<mirror::Object*>(javaDimArray); DCHECK(dimensions_obj->IsArrayInstance()); - DCHECK_STREQ(ClassHelper(dimensions_obj->GetClass()).GetDescriptor(), "[I"); + DCHECK_STREQ(dimensions_obj->GetClass()->GetDescriptor().c_str(), "[I"); Handle<mirror::IntArray> dimensions_array( hs.NewHandle(down_cast<mirror::IntArray*>(dimensions_obj))); mirror::Array* new_array = mirror::Array::CreateMultiArray(soa.Self(), element_class, |