diff options
author | Ian Rogers <irogers@google.com> | 2011-10-31 17:52:37 -0700 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2011-10-31 17:53:31 -0700 |
commit | 387b699e3dc55309023ae2427a76a1ca1d51b0cd (patch) | |
tree | 666cb441033fdbc0d1b19893e47df797ec5dafd1 /src | |
parent | 43c71a1a99785e1b25374aadb29817d43efba78f (diff) | |
download | art-387b699e3dc55309023ae2427a76a1ca1d51b0cd.zip art-387b699e3dc55309023ae2427a76a1ca1d51b0cd.tar.gz art-387b699e3dc55309023ae2427a76a1ca1d51b0cd.tar.bz2 |
Don't fail oat writing for unresolvable classes.
Change-Id: I48f3aa15bed80fbda6285525c0c888b3c07c2b52
Diffstat (limited to 'src')
-rw-r--r-- | src/oat_writer.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/oat_writer.cc b/src/oat_writer.cc index 2635bf8..26ce7c1 100644 --- a/src/oat_writer.cc +++ b/src/oat_writer.cc @@ -142,7 +142,13 @@ size_t OatWriter::InitOatCodeClassDef(size_t offset, // TODO: remove code ByteArrays from Class/Method (and therefore ClassLoader) // TODO: don't write code for shared stubs Class* klass = Runtime::Current()->GetClassLinker()->FindClass(descriptor, class_loader_); - CHECK(klass != NULL) << descriptor; + if (klass == NULL) { + LOG(WARNING) << "Didn't find class '" << descriptor << "' in dex file " << dex_file.GetLocation(); + Thread* thread = Thread::Current(); + DCHECK(thread->IsExceptionPending()); + thread->ClearException(); + return offset; + } CHECK_EQ(klass->GetClassLoader(), class_loader_); CHECK_EQ(oat_methods_[oat_class_index]->method_offsets_.size(), klass->NumDirectMethods() + num_virtual_methods); @@ -357,6 +363,13 @@ size_t OatWriter::WriteCodeClassDef(File* file, const char* descriptor = dex_file.GetClassDescriptor(class_def); ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); Class* klass = class_linker->FindClass(descriptor, class_loader_); + if (klass == NULL) { + LOG(WARNING) << "Didn't find class '" << descriptor << "' in dex file " << dex_file.GetLocation(); + Thread* thread = Thread::Current(); + DCHECK(thread->IsExceptionPending()); + thread->ClearException(); + return code_offset; + } // TODO: deduplicate code arrays // Note that we clear the code array here, image_writer will use GetCodeOffset to find it |