Cleanup resolution of type, field, method indexes
When resolving a type_idx of a static field, you cannot assume the
type_idx refers to the class that actually provides the storage, it
might be a subclass. The compiler now resolves to the storage class if
possible at compile time, otherwise it reverts to the slow path.
When resolve field and method indexes, you need to know if a field is
static or instance and if a method is direct or virtual. Previously we
tried to guess, which led to problems in classes that had one of
each. Now the compiler resolves which kind of field and method based
on the context of class definitions and dex instructions.
Change-Id: I31826dc90562057eadd81f39d6369aa1216509af
diff --git a/src/class_linker.cc b/src/class_linker.cc
index 5e05439..2adcd11 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -1450,7 +1450,7 @@
}
if (!class_linker->EnsureInitialized(klass, true)) {
CHECK(Thread::Current()->IsExceptionPending());
- UNIMPLEMENTED(FATAL) << "throw exception due to class initialization problem";
+ UNIMPLEMENTED(FATAL) << "throw class initialization error " << PrettyClass(klass);
}
referrer->GetDexCacheInitializedStaticStorage()->Set(type_idx, klass);
return klass;
@@ -1963,7 +1963,7 @@
for (size_t i = 0; i < num_fields; i++) {
Field* field = fields->Get(i);
if (false) { // enable to debug field layout
- LOG(INFO) << "LinkFields:"
+ LOG(INFO) << "LinkFields: " << (instance ? "instance" : "static")
<< " class=" << klass->GetDescriptor()->ToModifiedUtf8()
<< " field=" << field->GetName()->ToModifiedUtf8()
<< " offset=" << field->GetField32(MemberOffset(Field::OffsetOffset()), false);