summaryrefslogtreecommitdiff
path: root/compiler/driver/compiler_driver.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2018-10-23 12:42:00 +0100
committer Vladimir Marko <vmarko@google.com> 2018-12-19 16:09:50 +0000
commit29a533e30277e159327c24e27ed609d26479b2cd (patch)
treeb75a50e43945db1da197fc5c2d95caaaeb71af0a /compiler/driver/compiler_driver.cc
parentdadba138d745b1fb77da581f2d51fee20ccbac37 (diff)
Remove unresolved classes from image classes.
This allows compiling partial boot image, without conscrypt, while using the current image classes in preloaded-classes. Excluding the conscrypt makes the class android.security.net.config.TrustedCertificateStoreAdapter unresolved because it extends the class com.android.org.conscrypt.TrustedCertificateStore . Without pruning, we hit a DCHECK() in ImageWriter, checking that image classes are not erroneous. And we clearly do not want to put erroneous classes in the partial boot image. Test: Build partial boot image without conscrypt. Bug: 119868597 Change-Id: I6017462366a4b9e69abe1fb3d22461cab35f84c5
Diffstat (limited to 'compiler/driver/compiler_driver.cc')
-rw-r--r--compiler/driver/compiler_driver.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 0039be0fde..f52c566727 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -1231,8 +1231,15 @@ class ClinitImageUpdate {
bool operator()(ObjPtr<mirror::Class> klass) override REQUIRES_SHARED(Locks::mutator_lock_) {
std::string temp;
StringPiece name(klass->GetDescriptor(&temp));
- if (data_->image_class_descriptors_->find(name) != data_->image_class_descriptors_->end()) {
- data_->image_classes_.push_back(hs_.NewHandle(klass));
+ auto it = data_->image_class_descriptors_->find(name);
+ if (it != data_->image_class_descriptors_->end()) {
+ if (LIKELY(klass->IsResolved())) {
+ data_->image_classes_.push_back(hs_.NewHandle(klass));
+ } else {
+ DCHECK(klass->IsErroneousUnresolved());
+ VLOG(compiler) << "Removing unresolved class from image classes: " << name;
+ data_->image_class_descriptors_->erase(it);
+ }
} else {
// Check whether it is initialized and has a clinit. They must be kept, too.
if (klass->IsInitialized() && klass->FindClassInitializer(