Increase use of ScopedJniThreadState.
Move the routines for changing Object* to jobject and vice-versa
(AddLocalReference and Decode) to ScopedJniThreadState to enforce use of
Object*s in the Runnable thread state. In the Runnable thread state
suspension is necessary before GC can take place.
Reduce use of const ClassLoader* as the code bottoms out in FindClass
and with a field assignment where the const is cast away (ie if we're
not going to enforce the const-ness we shouldn't pretend it is).
Refactor the Thread::Attach API so that we're not handling raw Objects on
unattached threads.
Remove some unreachable code.
Change-Id: I0fa969f49ee6a8f10752af74a6b0e04d46b4cd97
diff --git a/src/verifier/method_verifier.cc b/src/verifier/method_verifier.cc
index f6a2ddb..ccc83da 100644
--- a/src/verifier/method_verifier.cc
+++ b/src/verifier/method_verifier.cc
@@ -204,8 +204,8 @@
return VerifyClass(&dex_file, kh.GetDexCache(), klass->GetClassLoader(), class_def_idx, error);
}
-MethodVerifier::FailureKind MethodVerifier::VerifyClass(const DexFile* dex_file, DexCache* dex_cache,
- const ClassLoader* class_loader, uint32_t class_def_idx, std::string& error) {
+MethodVerifier::FailureKind MethodVerifier::VerifyClass(const DexFile* dex_file,
+ DexCache* dex_cache, ClassLoader* class_loader, uint32_t class_def_idx, std::string& error) {
const DexFile::ClassDef& class_def = dex_file->GetClassDef(class_def_idx);
const byte* class_data = dex_file->GetClassData(class_def);
if (class_data == NULL) {
@@ -277,7 +277,7 @@
}
MethodVerifier::FailureKind MethodVerifier::VerifyMethod(uint32_t method_idx, const DexFile* dex_file,
- DexCache* dex_cache, const ClassLoader* class_loader, uint32_t class_def_idx,
+ DexCache* dex_cache, ClassLoader* class_loader, uint32_t class_def_idx,
const DexFile::CodeItem* code_item, Method* method, uint32_t method_access_flags) {
MethodVerifier verifier(dex_file, dex_cache, class_loader, class_def_idx, code_item, method_idx,
method, method_access_flags);
@@ -317,7 +317,7 @@
}
MethodVerifier::MethodVerifier(const DexFile* dex_file, DexCache* dex_cache,
- const ClassLoader* class_loader, uint32_t class_def_idx, const DexFile::CodeItem* code_item,
+ ClassLoader* class_loader, uint32_t class_def_idx, const DexFile::CodeItem* code_item,
uint32_t method_idx, Method* method, uint32_t method_access_flags)
: work_insn_idx_(-1),
method_idx_(method_idx),
@@ -2900,7 +2900,7 @@
field = GetInstanceField(object_type, field_idx);
}
const char* descriptor;
- const ClassLoader* loader;
+ ClassLoader* loader;
if (field != NULL) {
descriptor = FieldHelper(field).GetTypeDescriptor();
loader = field->GetDeclaringClass()->GetClassLoader();
@@ -2949,7 +2949,7 @@
field = GetInstanceField(object_type, field_idx);
}
const char* descriptor;
- const ClassLoader* loader;
+ ClassLoader* loader;
if (field != NULL) {
descriptor = FieldHelper(field).GetTypeDescriptor();
loader = field->GetDeclaringClass()->GetClassLoader();